/** * Add these Sets to the list of sets in this composite. * * @param set1 the first Set to be appended to the composite * @param set2 the second Set to be appended to the composite */ public void addComposited(final Set<E> set1, final Set<E> set2) { addComposited(set1); addComposited(set2); }
/** * Gets the navigable set being decorated. * * @return the decorated navigable set */ @Override protected NavigableSet<E> decorated() { return (NavigableSet<E>) super.decorated(); }
@Override public boolean addAll(final Collection<? extends E> coll) { boolean result = false; for (final E e : coll) { result |= add(e); } return result; }
/** * Gets an unmodifiable view as a Set. * * @return an unmodifiable set view */ public Set<E> asSet() { return UnmodifiableSet.unmodifiableSet(set); }
@Override public SortedSet<E> headSet(final E toElement) { final SortedSet<E> head = decorated().headSet(toElement); return UnmodifiableSortedSet.unmodifiableSortedSet(head); }
@Override public OrderedIterator<E> iterator() { return new OrderedSetIterator<>(setOrder.listIterator(), decorated()); }
/** * Gets the decorated set. * * @return the decorated set */ protected SortedSet<E> getSortedSet() { return (SortedSet<E>) decorated(); }
/** * Gets the set being decorated. * * @return the decorated set */ @Override protected NavigableSet<E> decorated() { return (NavigableSet<E>) super.decorated(); }
/** * Gets the set being decorated. * * @return the decorated set */ @Override protected SortedSet<E> decorated() { return (SortedSet<E>) super.decorated(); }
@Override public boolean removeAll(final Collection<?> coll) { boolean result = false; for (final Object name : coll) { result |= remove(name); } return result; }
/** * Gets the sorted set being decorated. * * @return the decorated sorted set */ @Override protected SortedSet<E> decorated() { return (SortedSet<E>) super.decorated(); }
/** * Returns an unmodifiable sorted set backed by the given sorted set. * <p> * This method uses the implementation in the decorators subpackage. * * @param <E> the element type * @param set the sorted set to make unmodifiable, must not be null * @return an unmodifiable set backed by the given set * @throws NullPointerException if the set is null */ public static <E> SortedSet<E> unmodifiableSortedSet(final SortedSet<E> set) { return UnmodifiableSortedSet.unmodifiableSortedSet(set); }
/** * Factory method to create a set from a map. * * @param <E> the element type * @param <V> the dummy value type in the map * @param map the map to decorate, must not be null * @return a new map backed set * @throws NullPointerException if map is null * @since 4.0 */ public static <E, V> MapBackedSet<E, V> mapBackedSet(final Map<E, ? super V> map) { return mapBackedSet(map, null); }
/** * Returns an unmodifiable set backed by the given set. * <p> * This method uses the implementation in the decorators subpackage. * * @param <E> the element type * @param set the set to make unmodifiable, must not be null * @return an unmodifiable set backed by the given set * @throws NullPointerException if the set is null */ public static <E> Set<E> unmodifiableSet(final Set<? extends E> set) { return UnmodifiableSet.unmodifiableSet(set); }
@Override public SortedSet<E> tailSet(final E fromElement) { final SortedSet<E> tail = decorated().tailSet(fromElement); return UnmodifiableSortedSet.unmodifiableSortedSet(tail); }
/** * Add these Sets to the list of sets in this composite * * @param sets the Sets to be appended to the composite */ public void addComposited(final Set<E>... sets) { for (final Set<E> set : sets) { addComposited(set); } }
/** * Gets the decorated navigable set. * * @return the decorated navigable set */ @Override protected NavigableSet<E> decorated() { return (NavigableSet<E>) super.decorated(); }
@Override public SortedSet<E> subSet(final E fromElement, final E toElement) { final SortedSet<E> sub = decorated().subSet(fromElement, toElement); return UnmodifiableSortedSet.unmodifiableSortedSet(sub); }
/** * Create a CompositeSet with just <code>set</code> composited. * * @param set the initial set in the composite */ public CompositeSet(final Set<E> set) { super(); addComposited(set); }
/** * Create a composite set with sets as the initial set of composited Sets. * * @param sets the initial sets in the composite */ public CompositeSet(final Set<E>... sets) { super(); addComposited(sets); }