-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAK-11458 : added utils class for replacing Guava's Iterables #2055
base: trunk
Are you sure you want to change the base?
Conversation
Commit-Check ✔️ |
What do we do when a class needs both our IterarbleUtils and those from commons-collections? (I'd say implement the methods and delegate) |
This is why I created the IterableUtils inside oak-commons module so we can implement the method with the same name and delegate it to Apache commons-collections4. |
Maybe I'm mssing something. Aren't we already using commons-collection4's IterableUtils in other places? |
Yes, we are using commons-collection4's IterableUtils in other places. But for this Iterables.concat use case, we hit a roadblock and had to implement our replacement for Iterables<Iterables> [1]. To avoid using different IterableUtils in each class (and polluting it with a complete class name), I have added other methods (to replace Iterables.concat) in oak-commons IterableUtils. Now, to avoid using both IterableUtils in the same class for other methods, When we hit this case, we will implement the method in oak-common's IterableUtils and replace it. So, gradually we would be replacing the commons-collection4's IterableUtils with our delegating methods. |
Missed valid complaints from Solarcloud.
@mbaedke the sonar complaints regarding Remove this array creation and simply pass the elements. are due to fact that I am creating an array beforehand passing the variables to an method that accepts varargs.
is calling
from same class i.e. IterableUtils in oak-commons. In case I don't create an array, I would be calling the caller method thus creating an infinite loop.
this is the same pattern used inside commons-collections4. One possible way to avoid is to call commons-collections4 api's from each method rather than delegating the call to commons-collections4 to a single method.
|
…ions method directly from each API
8753df2
to
16134e5
Compare
|
* @return an {@code Iterable} that provides a single view of all elements in the input {@code Iterable} instances | ||
* @throws NullPointerException if the input {@code Iterable} or any of its elements are null | ||
*/ | ||
public static <E> Iterable<E> chainedIterable(final Iterable<? extends Iterable<? extends E>> iterables) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually used anywhere in the code?
No description provided.