Hi community,

Currently, I am using commons-collections4, this is great.
But I find there might be somewhere that can be enhanced.

We usually use CollectionUtils to transform one collection to another
collection.

public static <I, O> Collection<O> collect(final Iterable<I>
inputCollection, final Transformer<? super I, ? extends O> transformer) {
    final Collection<O> answer = inputCollection instanceof Collection<?> ?
new ArrayList<>(((Collection<?>) inputCollection).size()) : new
ArrayList<>();
    return collect(inputCollection, transformer, answer);
}

But this API can just return a new ArrayList, sometimes we want to
transform a set to set or collection to set.

So, can we add a new method named collectToSet and rename the current
method collect to collectToList.
This might be helpful.

If you think this is reasonable, I will try to submit a pr.


Thanks,
Wenjun Ruan

Reply via email to