Skip to content
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

Draft
wants to merge 21 commits into
base: trunk
Choose a base branch
from
Draft

Conversation

reschke
Copy link
Contributor

@reschke reschke commented Sep 17, 2024

No description provided.

@reschke reschke marked this pull request as draft September 17, 2024 10:20
Copy link
Contributor

@nfsantos nfsantos left a 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();
Copy link
Contributor

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();
}

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@rishabhdaim
Copy link
Contributor

Could you please revert changes to ImmutableSet/List.copyOf() from this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants