Class NullSkippingTreeSet<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
java.util.TreeSet<E>
io.github.connellite.collections.NullSkippingTreeSet<E>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, NavigableSet<E>, Set<E>, SortedSet<E>

public class NullSkippingTreeSet<E> extends TreeSet<E>
TreeSet that ignores null on add / addAll (safe copy from arbitrary collections).
See Also:
  • Constructor Details

    • NullSkippingTreeSet

      public NullSkippingTreeSet()
    • NullSkippingTreeSet

      public NullSkippingTreeSet(Comparator<? super E> comparator)
    • NullSkippingTreeSet

      public NullSkippingTreeSet(Collection<? extends E> c)
    • NullSkippingTreeSet

      public NullSkippingTreeSet(SortedSet<E> s)
  • Method Details

    • add

      public boolean add(E e)
      Adds a non-null element to the set.
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface Set<E>
      Overrides:
      add in class TreeSet<E>
      Parameters:
      e - element to add
      Returns:
      true if element was added; false for null
    • addAll

      public boolean addAll(Collection<? extends E> c)
      Adds all non-null elements from the source collection.
      Specified by:
      addAll in interface Collection<E>
      Specified by:
      addAll in interface Set<E>
      Overrides:
      addAll in class TreeSet<E>
      Parameters:
      c - source collection
      Returns:
      true if at least one element was added