hemanth0525 commented on PR #537:
URL:
https://github.com/apache/commons-collections/pull/537#issuecomment-2327059129
sorry !
I will look for the use cases.
Suggested Improvement
For the duplicateList method, it might be more appropriate to call
duplicateSequencedSet instead of duplicateSet. Since the method returns a List,
preserving the order of elements is often expected or desirable. By using
duplicateSequencedSet, we can ensure that the order of duplicate elements is
maintained, providing a more intuitive and consistent behavior for users of
this method.
```
/**
* Finds and returns the List of duplicate elements in the given
collection.
*
* @param <E> the type of elements in the collection.
* @param iterable the list to test, must not be null.
* @return the set of duplicate elements, may be empty.
* @since 4.5.0-M3
*/
public static <E> List<E> duplicateList(final Iterable<E> iterable) {
return new ArrayList<>(duplicateSet(iterable));
}
```
since we are using list . we tend to preserve the order in many cases
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]