Class UnmodifiableNavigableSet<E>

  • Type Parameters:
    E - the type of the elements in this set
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.NavigableSet<E>, java.util.Set<E>, java.util.SortedSet<E>, Unmodifiable

    public final class UnmodifiableNavigableSet<E>
    extends AbstractNavigableSetDecorator<E>
    implements Unmodifiable
    Decorates another NavigableSet to ensure it can't be altered.

    Attempts to modify it will result in an UnsupportedOperationException.

    Since:
    4.1
    See Also:
    Serialized Form
    • Method Detail

      • unmodifiableNavigableSet

        public static <E> java.util.NavigableSet<E> unmodifiableNavigableSet​(java.util.NavigableSet<E> set)
        Factory method to create an unmodifiable set.
        Type Parameters:
        E - the element type
        Parameters:
        set - the set to decorate, must not be null
        Returns:
        a new unmodifiable NavigableSet
        Throws:
        java.lang.NullPointerException - if set is null
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E>
        Specified by:
        iterator in interface java.lang.Iterable<E>
        Specified by:
        iterator in interface java.util.NavigableSet<E>
        Specified by:
        iterator in interface java.util.Set<E>
        Overrides:
        iterator in class AbstractCollectionDecorator<E>
      • add

        public boolean add​(E object)
        Specified by:
        add in interface java.util.Collection<E>
        Specified by:
        add in interface java.util.Set<E>
        Overrides:
        add in class AbstractCollectionDecorator<E>
      • addAll

        public boolean addAll​(java.util.Collection<? extends E> coll)
        Specified by:
        addAll in interface java.util.Collection<E>
        Specified by:
        addAll in interface java.util.Set<E>
        Overrides:
        addAll in class AbstractCollectionDecorator<E>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E>
        Specified by:
        clear in interface java.util.Set<E>
        Overrides:
        clear in class AbstractCollectionDecorator<E>
      • remove

        public boolean remove​(java.lang.Object object)
        Specified by:
        remove in interface java.util.Collection<E>
        Specified by:
        remove in interface java.util.Set<E>
        Overrides:
        remove in class AbstractCollectionDecorator<E>
      • removeIf

        public boolean removeIf​(java.util.function.Predicate<? super E> filter)
        Specified by:
        removeIf in interface java.util.Collection<E>
        Overrides:
        removeIf in class AbstractCollectionDecorator<E>
        Since:
        4.4
      • removeAll

        public boolean removeAll​(java.util.Collection<?> coll)
        Specified by:
        removeAll in interface java.util.Collection<E>
        Specified by:
        removeAll in interface java.util.Set<E>
        Overrides:
        removeAll in class AbstractCollectionDecorator<E>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> coll)
        Specified by:
        retainAll in interface java.util.Collection<E>
        Specified by:
        retainAll in interface java.util.Set<E>
        Overrides:
        retainAll in class AbstractCollectionDecorator<E>
      • subSet

        public java.util.SortedSet<E> subSet​(E fromElement,
                                             E toElement)
        Specified by:
        subSet in interface java.util.NavigableSet<E>
        Specified by:
        subSet in interface java.util.SortedSet<E>
        Overrides:
        subSet in class AbstractSortedSetDecorator<E>
      • headSet

        public java.util.SortedSet<E> headSet​(E toElement)
        Specified by:
        headSet in interface java.util.NavigableSet<E>
        Specified by:
        headSet in interface java.util.SortedSet<E>
        Overrides:
        headSet in class AbstractSortedSetDecorator<E>
      • tailSet

        public java.util.SortedSet<E> tailSet​(E fromElement)
        Specified by:
        tailSet in interface java.util.NavigableSet<E>
        Specified by:
        tailSet in interface java.util.SortedSet<E>
        Overrides:
        tailSet in class AbstractSortedSetDecorator<E>
      • subSet

        public java.util.NavigableSet<E> subSet​(E fromElement,
                                                boolean fromInclusive,
                                                E toElement,
                                                boolean toInclusive)
        Specified by:
        subSet in interface java.util.NavigableSet<E>
        Overrides:
        subSet in class AbstractNavigableSetDecorator<E>
      • headSet

        public java.util.NavigableSet<E> headSet​(E toElement,
                                                 boolean inclusive)
        Specified by:
        headSet in interface java.util.NavigableSet<E>
        Overrides:
        headSet in class AbstractNavigableSetDecorator<E>
      • tailSet

        public java.util.NavigableSet<E> tailSet​(E fromElement,
                                                 boolean inclusive)
        Specified by:
        tailSet in interface java.util.NavigableSet<E>
        Overrides:
        tailSet in class AbstractNavigableSetDecorator<E>