Class ImmutableNullableSet<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.apache.calcite.util.ImmutableNullableSet<E>
Type Parameters:
E - Element type
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class ImmutableNullableSet<E> extends AbstractSet<E>
An immutable set that may contain null values.

If the set cannot contain null values, use ImmutableSet.

We do not yet support sorted sets.

  • Method Details

    • iterator

      public Iterator<E> iterator()
      Specified by:
      iterator in interface Collection<E>
      Specified by:
      iterator in interface Iterable<E>
      Specified by:
      iterator in interface Set<E>
      Specified by:
      iterator in class AbstractCollection<E>
    • size

      public int size()
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface Set<E>
      Specified by:
      size in class AbstractCollection<E>
    • contains

      public boolean contains(@Nullable Object o)
      Specified by:
      contains in interface Collection<E>
      Specified by:
      contains in interface Set<E>
      Overrides:
      contains in class AbstractCollection<E>
    • remove

      public boolean remove(@Nullable Object o)
      Specified by:
      remove in interface Collection<E>
      Specified by:
      remove in interface Set<E>
      Overrides:
      remove in class AbstractCollection<E>
    • removeAll

      public boolean removeAll(Collection<?> c)
      Specified by:
      removeAll in interface Collection<E>
      Specified by:
      removeAll in interface Set<E>
      Overrides:
      removeAll in class AbstractSet<E>
    • copyOf

      public static <E> Set<E> copyOf(Iterable<? extends E> elements)
      Returns an immutable set containing the given elements.

      Behavior is as ImmutableSet.copyOf(Iterable) except that this set allows nulls.

    • copyOf

      public static <E> Set<E> copyOf(E[] elements)
      Returns an immutable set containing the given elements.

      Behavior as ImmutableSet.copyOf(Object[]) except that this set allows nulls.

    • of

      public static <E> Set<E> of(E e1)
      Creates an immutable set of 1 element.
    • of

      public static <E> Set<E> of(E e1, E e2)
      Creates an immutable set of 2 elements.
    • of

      public static <E> Set<E> of(E e1, E e2, E e3)
      Creates an immutable set of 3 elements.
    • of

      public static <E> Set<E> of(E e1, E e2, E e3, E e4)
      Creates an immutable set of 4 elements.
    • of

      public static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E... others)
      Creates an immutable set of 5 or more elements.
    • builder

      public static <E> ImmutableNullableSet.Builder<E> builder()
      Returns a new builder. The generated builder is equivalent to the builder created by the ImmutableNullableSet.Builder constructor.