Class SmallSet<T>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<T>
org.objectweb.asm.tree.analysis.SmallSet<T>
All Implemented Interfaces:
Iterable<T>, Collection<T>, Set<T>

final class SmallSet<T> extends AbstractSet<T>
An immutable set of at most two elements, optimized for speed compared to a generic set implementation.
  • Field Details

    • element1

      private final T element1
      The first element of this set, maybe null.
    • element2

      private final T element2
      The second element of this set, maybe null. If element1 is null then this field must be null, otherwise it must be different from element1.
  • Constructor Details

    • SmallSet

      SmallSet()
      Constructs an empty set.
    • SmallSet

      SmallSet(T element)
      Constructs a set with exactly one element.
      Parameters:
      element - the unique set element.
    • SmallSet

      private SmallSet(T element1, T element2)
      Constructs a new SmallSet.
      Parameters:
      element1 - see element1.
      element2 - see element2.
  • Method Details