Class TreeSet<E>

    • Field Detail

      • tree

        private final Tree<E,​E> tree
      • EMPTY

        protected static final TreeSet EMPTY
    • Constructor Detail

      • TreeSet

        public TreeSet()
      • TreeSet

        public TreeSet​(java.util.Comparator<? super E> ordering)
    • Method Detail

      • factory

        @NotNull
        public static <E> @NotNull BuilderFactory<E,​TreeSet<E>> factory​(java.util.Comparator<? super E> ordering)
      • empty

        @NotNull
        public static <E> @NotNull TreeSet<E> empty()
      • comparator

        public java.util.Comparator<? super E> comparator()
        Description copied from interface: SortedSet
        Returns the comparator associated with this map, or null if the default ordering is used.
      • add

        @NotNull
        public @NotNull TreeSet<E> add​(E value)
        Description copied from interface: Set
        Returns a set that adds the specified value if it doesn't already exist in this set.
      • remove

        @NotNull
        public @NotNull TreeSet<E> remove​(E value)
        Description copied from interface: Set
        Removes the specified value from the set if it exists.
      • contains

        public boolean contains​(E value)
        Description copied from interface: Set
        Returns true if the value exists in this set.
      • size

        public int size()
        Description copied from interface: Traversable
        Returns the size of the collection.

        Warning: infinite collections are possible, as are collections that require traversal to calculate the size.

        Specified by:
        size in interface Traversable<E>
        Overrides:
        size in class AbstractTraversable<E>
      • first

        @Nullable
        public E first()
        Description copied from interface: SortedSet
        Returns the first element in the set or null of the set is empty.
      • last

        @Nullable
        public E last()
        Description copied from interface: SortedSet
        Returns the last element in the set or null of the set is empty.
      • iterator

        @NotNull
        public @NotNull java.util.Iterator<E> iterator()
      • drop

        @NotNull
        public @NotNull SortedSet<E> drop​(int number)
        Description copied from interface: SortedSet
        Returns a set containing all elements in this set, excluding the first number of elements.
      • take

        @NotNull
        public @NotNull SortedSet<E> take​(int number)
        Description copied from interface: SortedSet
        Returns a set containing the first number of elements from this set.
      • from

        @NotNull
        public @NotNull SortedSet<E> from​(@NotNull
                                          E value,
                                          boolean inclusive)
        Description copied from interface: SortedSet
        Returns the bottom of the set starting from the key specified.
        Specified by:
        from in interface SortedSet<E>
        Overrides:
        from in class AbstractSortedSet<E>
        inclusive - if true, the key will be included in the result, otherwise it will be excluded
      • to

        @NotNull
        public @NotNull SortedSet<E> to​(@NotNull
                                        E value,
                                        boolean inclusive)
        Description copied from interface: SortedSet
        Returns the top of the set up until the key specified.
        Specified by:
        to in interface SortedSet<E>
        Overrides:
        to in class AbstractSortedSet<E>
        inclusive - if true, the key will be included in the result, otherwise it will be excluded
      • range

        @NotNull
        public @NotNull SortedSet<E> range​(@NotNull
                                           E from,
                                           boolean fromInclusive,
                                           @NotNull
                                           E to,
                                           boolean toInclusive)
        Description copied from interface: SortedSet
        Returns a subset of the set between the from and to keys specified.
        fromInclusive - if true, the key will be included in the result, otherwise it will be excluded
        toInclusive - if true, the key will be included in the result, otherwise it will be excluded