Class FieldBasedScalingSet<E>

  • All Implemented Interfaces:
    Iterable<E>, Collection<E>, Set<E>

    public final class FieldBasedScalingSet<E>
    extends Object
    implements Set<E>
    Uses a given Set as storage unless it is the first and only value, in which case it uses a field. This helps avoid the overhead of creating and accessing the set if we only have 1 value. This implementation is not thread-safe, regardless of the underlying Set. Iteration order of elements is specified by the underlying Set.