-
Notifications
You must be signed in to change notification settings - Fork 410
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-11100: remove use of Guava transform/filter #1723
base: trunk
Are you sure you want to change the base?
Conversation
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.
Ok for oak-run-common and oak-run modules. I did not look at the other modules.
@@ -234,7 +235,8 @@ private Map<ExternalIdentityRef, SyncEntry> collectSyncEntries(@NotNull Iterable | |||
*/ | |||
private void collectSyncEntries(@NotNull Iterable<ExternalIdentityRef> declaredGroupRefs, long depth, @NotNull Map<ExternalIdentityRef, SyncEntry> map) throws ExternalIdentityException, RepositoryException { | |||
boolean shortcut = shortcut(depth); | |||
for (ExternalIdentityRef ref : Iterables.filter(declaredGroupRefs, this::isSameIDP)) { | |||
Iterable<ExternalIdentityRef> filtered = () -> CollectionUtils.toStream(declaredGroupRefs).filter(this::isSameIDP).iterator(); |
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.
How about having a util for this transformation as well?
@NotNull
public static Iterable toIterable(@NotNull Iterable iterable, @NotNull Predicate<? super T> predicate) {
Objects.requireNonNull(iterable);
Objects.requireNonNull(predicate);
return () -> StreamSupport.stream(iterable.spliterator(), false).filter(predicate).iterator();
}
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.
Another option could be to use commons-collections
IterableUtils.filteredIterable
and same goes for Iterator
.
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.
Using the first proposal wouldn't work well when mutiple stream manipulations are changed.
Could you please revert changes to |
No description provided.