Hi Peter, On 26/03/2019 18:01, Peter Levart wrote:
Would such method addition be worth it?
Here is the impl of Set.copyOf:
static <E> Set<E> copyOf(Collection<? extends E> coll) {
if (coll instanceof ImmutableCollections.AbstractImmutableSet) {
return (Set<E>)coll;
} else {
return (Set<E>)Set.of(new HashSet<>(coll).toArray());
}
}
Best regards,
-- daniel
