[ 
https://issues.apache.org/jira/browse/OAK-11449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17922949#comment-17922949
 ] 

Rishabh Daim edited comment on OAK-11449 at 2/1/25 4:03 PM:
------------------------------------------------------------

To concat {*}Iterables{*}, we have the following options available with us:

 
 # Using *Stream.concat() OR Stream.flatMap():* We can use native Java Code to 
concat multiple Iterables via Stream API [1]. Still, it would require us to 
return any concrete implementation of the Iterable interface such as List/Set 
(after using {*}collect{*}) rather than an Iterable itself. This would result 
in some cases changing the type of actual iterable (which could be any 
collections class).

           If we return any Iterable backed by Stream, we can only iterate it 
once. This might be problematic in some cases.
 # Using *IterableUtils.chainedIterable:* Apache *commons-collections4* 
provides the utility to concat multiple streams via 
*IterableUtils.chainedIterable* [2] without changing the incoming iterable 
types. This is a replica of Guava's implementation.

 

cc [~reschke] [~baedke] 

 

[1] 
[https://www.baeldung.com/java-combine-multiple-collections#using-java-8-stream-api]

[2] 
[https://www.baeldung.com/java-combine-multiple-collections#using-apache-commons-collections]


was (Author: JIRAUSER299730):
To concat {*}Iterables{*}, we have the following options available with us:

 
 # Using *Stream.concat() OR Stream.flatMap():* We can use native Java Code to 
concat multiple Iterables via Stream API [1]. Still, it would require us to 
return any concrete implementation of the Iterable interface such as List/Set 
(after using {*}collect{*}) rather than an Iterable itself. This would result 
in some cases changing the type of actual iterable (which could be any 
collections class).
 # Using *IterableUtils.chainedIterable:* Apache *commons-collections4* 
provides the utility to concat multiple streams via 
*IterableUtils.chainedIterable* [2] ** without changing the incoming iterable 
types. This is a replica of Guava's implementation.

 

cc [~reschke] [~baedke] 

 

[1] 
[https://www.baeldung.com/java-combine-multiple-collections#using-java-8-stream-api]
 


[2] 
[https://www.baeldung.com/java-combine-multiple-collections#using-apache-commons-collections]

> Remove usage of Guava Iterables.concat()
> ----------------------------------------
>
>                 Key: OAK-11449
>                 URL: https://issues.apache.org/jira/browse/OAK-11449
>             Project: Jackrabbit Oak
>          Issue Type: Technical task
>            Reporter: Rishabh Daim
>            Assignee: Rishabh Daim
>            Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to