Interface CharSet

All Superinterfaces:
CharCollection, CharIterable, java.util.Collection<java.lang.Character>, java.lang.Iterable<java.lang.Character>, java.util.Set<java.lang.Character>
All Known Subinterfaces:
CharSortedSet
All Known Implementing Classes:
AbstractCharSet, AbstractCharSortedSet, CharArraySet, CharAVLTreeSet, CharLinkedOpenCustomHashSet, CharLinkedOpenHashSet, CharOpenCustomHashSet, CharOpenHashSet, CharRBTreeSet, CharSets.EmptySet, CharSets.Singleton, CharSets.SynchronizedSet, CharSets.UnmodifiableSet, CharSortedSets.EmptySet, CharSortedSets.Singleton, CharSortedSets.SynchronizedSortedSet, CharSortedSets.UnmodifiableSortedSet

public interface CharSet
extends CharCollection, java.util.Set<java.lang.Character>
A type-specific Set; provides some additional methods that use polymorphism to avoid (un)boxing.

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

See Also:
Set
  • Method Summary

    Modifier and Type Method Description
    default boolean add​(java.lang.Character o)
    Deprecated.
    Please use the corresponding type-specific method instead.
    default boolean contains​(java.lang.Object o)
    Deprecated.
    Please use the corresponding type-specific method instead.
    CharIterator iterator()
    Returns a type-specific iterator on the elements of this set.
    static CharSet of()
    Returns an immutable empty set.
    static CharSet of​(char e)
    Returns an immutable set with the element given.
    static CharSet of​(char... a)
    Returns an immutable list with the elements given.
    static CharSet of​(char e0, char e1)
    Returns an immutable set with the elements given.
    static CharSet of​(char e0, char e1, char e2)
    Returns an immutable set with the elements given.
    default boolean rem​(char k)
    Deprecated.
    Please use remove() instead.
    boolean remove​(char k)
    Removes an element from this set.
    default boolean remove​(java.lang.Object o)
    Deprecated.
    Please use the corresponding type-specific method instead.
    default CharSpliterator spliterator()
    Returns a type-specific spliterator on the elements of this set.

    Methods inherited from interface it.unimi.dsi.fastutil.chars.CharIterable

    forEach, forEach, forEach

    Methods inherited from interface java.util.Collection

    toArray

    Methods inherited from interface java.util.Set

    addAll, clear, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, size, toArray, toArray
  • Method Details

    • iterator

      CharIterator iterator()
      Returns a type-specific iterator on the elements of this set.
      Specified by:
      iterator in interface CharCollection
      Specified by:
      iterator in interface CharIterable
      Specified by:
      iterator in interface java.util.Collection<java.lang.Character>
      Specified by:
      iterator in interface java.lang.Iterable<java.lang.Character>
      Specified by:
      iterator in interface java.util.Set<java.lang.Character>
      Returns:
      a type-specific iterator on the elements of this set.
      See Also:
      Iterable.iterator()
      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 CharSpliterator 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 CharCollection
      Specified by:
      spliterator in interface CharIterable
      Specified by:
      spliterator in interface java.util.Collection<java.lang.Character>
      Specified by:
      spliterator in interface java.lang.Iterable<java.lang.Character>
      Specified by:
      spliterator in interface java.util.Set<java.lang.Character>
      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​(char k)
      Removes an element from this set.
      See Also:
      Collection.remove(Object)
      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​(java.lang.Object o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      remove in interface CharCollection
      Specified by:
      remove in interface java.util.Collection<java.lang.Character>
      Specified by:
      remove in interface java.util.Set<java.lang.Character>
    • add

      @Deprecated default boolean add​(java.lang.Character o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      add in interface CharCollection
      Specified by:
      add in interface java.util.Collection<java.lang.Character>
      Specified by:
      add in interface java.util.Set<java.lang.Character>
    • contains

      @Deprecated default boolean contains​(java.lang.Object o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      contains in interface CharCollection
      Specified by:
      contains in interface java.util.Collection<java.lang.Character>
      Specified by:
      contains in interface java.util.Set<java.lang.Character>
    • rem

      @Deprecated default boolean rem​(char 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 CharCollection
      See Also:
      Collection.remove(Object)
    • of

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

      static CharSet of​(char e)
      Returns an immutable set with the element given.
      Parameters:
      e - an element.
      Returns:
      an immutable set containing e.
    • of

      static CharSet of​(char e0, char 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:
      java.lang.IllegalArgumentException - if there were duplicate entries.
    • of

      static CharSet of​(char e0, char e1, char 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:
      java.lang.IllegalArgumentException - if there were duplicate entries.
    • of

      static CharSet of​(char... 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:
      java.lang.IllegalArgumentException - if there are any duplicate entries.