Thanks, that makes absolute sense.

Do you think there is any desire to have a similar method for not-sorted
lists?

Best,
Simone

On Thu, 19 Jun 2025, 16:00 sebb, <[email protected]> wrote:

> On Thu, 19 Jun 2025 at 15:27, Simone Ivan Conte
> <[email protected]> wrote:
> >
> > Hello,
> >
> > This is my first time writing to this mailing list. I hope it is the
> right
> > one to reach out the Apache Commons community.
> >
> > I was looking at the use of CollectionUtils.collate and there is an
> option
> > to NOT include duplicates:
> >
> > var collated = CollectionUtils.collate(List.of("a", "b"), List.of("b",
> > "a"), false);
> >
> > assertThat(collated)
> >         .containsExactly("a", "b");
> >
> > At least that is my understanding. However the test above fails, as the
> > item "a" is not identified as a duplicate.
>
> According to the Javadoc [1], CollectionUtils.collate expects the
> collections to be sorted.
>
> That is not the case for the second List, which is presumably why the
> assertion fails.
>
> [1]
> https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/CollectionUtils.html#collate(java.lang.Iterable,java.lang.Iterable,boolean)
>
> > I would be more than happy to look at this issue and contribute myself
> to a
> > fix, but wanted to reach out first to make sure this is an issue in the
> > first place or I have just misinterpreted the javadocs.
> >
> > Thanks and best regards,
> > Simone (sic2)
>

Reply via email to