Interface FloatSet

All Superinterfaces:
Collection<Float>, FloatCollection, FloatIterable, Iterable<Float>, Set<Float>
All Known Subinterfaces:
FloatSortedSet
All Known Implementing Classes:
AbstractFloatSet, AbstractFloatSortedSet, FloatArraySet, FloatAVLTreeSet, FloatLinkedOpenCustomHashSet, FloatLinkedOpenHashSet, FloatOpenCustomHashSet, FloatOpenHashBigSet, FloatOpenHashSet, FloatRBTreeSet, FloatSets.EmptySet, FloatSets.Singleton, FloatSets.SynchronizedSet, FloatSets.UnmodifiableSet, FloatSortedSets.EmptySet, FloatSortedSets.Singleton, FloatSortedSets.SynchronizedSortedSet, FloatSortedSets.UnmodifiableSortedSet

public interface FloatSet extends FloatCollection, Set<Float>
A type-specific Set; provides some additional methods that use polymorphism to avoid (un)boxing.

Additionally, this interface strengthens (again) iterator().

See Also:
  • Method Details

    • iterator

      FloatIterator iterator()
      Returns a type-specific iterator on the elements of this set.
      Specified by:
      iterator in interface Collection<Float>
      Specified by:
      iterator in interface FloatCollection
      Specified by:
      iterator in interface FloatIterable
      Specified by:
      iterator in interface Iterable<Float>
      Specified by:
      iterator in interface Set<Float>
      Returns:
      a type-specific iterator on the elements of this set.
      See Also:
      API Notes:
      This specification strengthens the one given in Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extends Set.

      Also, this is generally the only iterator method subclasses should override.

    • spliterator

      default FloatSpliterator spliterator()
      Returns a type-specific spliterator on the elements of this set.

      Set spliterators must report at least Spliterator.DISTINCT.

      See Set.spliterator() for more documentation on the requirements of the returned spliterator.

      Specified by:
      spliterator in interface Collection<Float>
      Specified by:
      spliterator in interface FloatCollection
      Specified by:
      spliterator in interface FloatIterable
      Specified by:
      spliterator in interface Iterable<Float>
      Specified by:
      spliterator in interface Set<Float>
      Returns:
      a type-specific spliterator on the elements of this collection.
      Since:
      8.5.0
      API Notes:
      This specification strengthens the one given in Collection.spliterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extends Set.

      Also, this is generally the only spliterator method subclasses should override.

      Implementation Specification:
      The default implementation returns a late-binding spliterator (see Spliterator for documentation on what binding policies mean) that wraps this instance's type specific iterator().

      Additionally, it reports Spliterator.SIZED and Spliterator.DISTINCT.

      Implementation Notes:
      As this default implementation wraps the iterator, and Iterator is an inherently linear API, the returned spliterator will yield limited performance gains when run in parallel contexts, as the returned spliterator's trySplit() will have linear runtime.
    • remove

      boolean remove(float k)
      Removes an element from this set.
      See Also:
      API Notes:
      Note that the corresponding method of a type-specific collection is rem(). This unfortunate situation is caused by the clash with the similarly named index-based method in the List interface.
    • remove

      @Deprecated default boolean remove(Object o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      remove in interface Collection<Float>
      Specified by:
      remove in interface FloatCollection
      Specified by:
      remove in interface Set<Float>
    • add

      @Deprecated default boolean add(Float o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      add in interface Collection<Float>
      Specified by:
      add in interface FloatCollection
      Specified by:
      add in interface Set<Float>
    • contains

      @Deprecated default boolean contains(Object o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      contains in interface Collection<Float>
      Specified by:
      contains in interface FloatCollection
      Specified by:
      contains in interface Set<Float>
    • rem

      @Deprecated default boolean rem(float k)
      Deprecated.
      Please use remove() instead.
      Removes an element from this set.

      This method is inherited from the type-specific collection this type-specific set is based on, but it should not used as this interface reinstates remove() as removal method.

      Specified by:
      rem in interface FloatCollection
      See Also:
    • of

      static FloatSet of()
      Returns an immutable empty set.
      Returns:
      an immutable empty set.
    • of

      static FloatSet of(float e)
      Returns an immutable set with the element given.
      Parameters:
      e - an element.
      Returns:
      an immutable set containing e.
    • of

      static FloatSet of(float e0, float e1)
      Returns an immutable set with the elements given.
      Parameters:
      e0 - the first element.
      e1 - the second element.
      Returns:
      an immutable set containing e0 and e1.
      Throws:
      IllegalArgumentException - if there were duplicate entries.
    • of

      static FloatSet of(float e0, float e1, float e2)
      Returns an immutable set with the elements given.
      Parameters:
      e0 - the first element.
      e1 - the second element.
      e2 - the third element.
      Returns:
      an immutable set containing e0, e1, and e2.
      Throws:
      IllegalArgumentException - if there were duplicate entries.
    • of

      static FloatSet of(float... a)
      Returns an immutable list with the elements given.
      Parameters:
      a - the list of elements that will be in the final set.
      Returns:
      an immutable set containing the elements in a.
      Throws:
      IllegalArgumentException - if there are any duplicate entries.