Class FloatArraySet

All Implemented Interfaces:
FloatCollection, FloatIterable, FloatSet, Serializable, Cloneable, Iterable<Float>, Collection<Float>, Set<Float>

public class FloatArraySet extends AbstractFloatSet implements Serializable, Cloneable
A simple, brute-force implementation of a set based on a backing array.

The main purpose of this implementation is that of wrapping cleanly the brute-force approach to the storage of a very small number of items: just put them into an array and scan linearly to find an item.

See Also:
  • Constructor Details

    • FloatArraySet

      public FloatArraySet(float[] a)
      Creates a new array set using the given backing array. The resulting set will have as many elements as the array.

      It is the responsibility of the caller to ensure that the elements of a are distinct.

      Parameters:
      a - the backing array.
    • FloatArraySet

      public FloatArraySet()
      Creates a new empty array set.
    • FloatArraySet

      public FloatArraySet(int capacity)
      Creates a new empty array set of given initial capacity.
      Parameters:
      capacity - the initial capacity.
    • FloatArraySet

      public FloatArraySet(FloatCollection c)
      Creates a new array set copying the contents of a given collection.
      Parameters:
      c - a collection.
    • FloatArraySet

      public FloatArraySet(Collection<? extends Float> c)
      Creates a new array set copying the contents of a given set.
      Parameters:
      c - a collection.
    • FloatArraySet

      public FloatArraySet(FloatSet c)
      Creates a new array set copying the contents of a given collection.
      Parameters:
      c - a collection.
    • FloatArraySet

      public FloatArraySet(Set<? extends Float> c)
      Creates a new array set copying the contents of a given set.
      Parameters:
      c - a collection.
    • FloatArraySet

      public FloatArraySet(float[] a, int size)
      Creates a new array set using the given backing array and the given number of elements of the array.

      It is the responsibility of the caller to ensure that the first size elements of a are distinct.

      Parameters:
      a - the backing array.
      size - the number of valid elements in a.
  • Method Details