/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * <p> * Existing entries in the specified set will not be transformed. * If you want that behaviour, see {@link TransformedSet#transformedSet}. * * @param <E> the element type * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws NullPointerException if the set or transformer is null */ public static <E> Set<E> transformedSet(final Set<E> set, final Transformer<? super E, ? extends E> transformer) { return TransformedSet.transformingSet(set, transformer); }
@Override public Set<E> uniqueSet() { final Set<E> set = getBag().uniqueSet(); return TransformedSet.<E>transformingSet(set, transformer); }