Interface CharCollection
-
- All Superinterfaces:
CharIterable,Collection<Character>,Iterable<Character>
- All Known Implementing Classes:
AbstractCharCollection,AbstractCharList,AbstractCharList.CharSubList,AbstractCharSet,CharArrayList
public interface CharCollection extends Collection<Character>, CharIterable
A type-specificCollection; provides some additional methods that use polymorphism to avoid (un)boxing.Additionally, this class defines strengthens (again)
iterator()and defines a slightly different semantics fortoArray(Object[]).- See Also:
Collection
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleanadd(char key)booleanaddAll(CharCollection c)CharIteratorcharIterator()Deprecated.As offastutil5, replaced byiterator().booleancontains(char key)booleancontainsAll(CharCollection c)CharIteratoriterator()Returns a type-specific iterator on the elements of this collection.booleanrem(char key)booleanremoveAll(CharCollection c)booleanretainAll(CharCollection c)char[]toArray(char[] a)Returns a primitive type array containing the items of this collection.<T> T[]toArray(T[] a)Returns an containing the items of this collection; the runtime type of the returned array is that of the specified array.char[]toCharArray()Returns a primitive type array containing the items of this collection.char[]toCharArray(char[] a)Returns a primitive type array containing the items of this collection.-
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
-
-
-
-
Method Detail
-
iterator
CharIterator iterator()
Returns a type-specific iterator on the elements of this collection.Note that 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 extendsCollection.- Specified by:
iteratorin interfaceCharIterable- Specified by:
iteratorin interfaceCollection<Character>- Specified by:
iteratorin interfaceIterable<Character>- Returns:
- a type-specific iterator on the elements of this collection.
-
charIterator
@Deprecated CharIterator charIterator()
Deprecated.As offastutil5, replaced byiterator().Returns a type-specific iterator on this elements of this collection.- See Also:
iterator()
-
toArray
<T> T[] toArray(T[] a)
Returns an containing the items of this collection; the runtime type of the returned array is that of the specified array.Warning: Note that, contrarily to
Collection.toArray(Object[]), this methods just writes all elements of this collection: no special value will be added after the last one.- Specified by:
toArrayin interfaceCollection<Character>- Parameters:
a- if this array is big enough, it will be used to store this collection.- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray(Object[])
-
contains
boolean contains(char key)
- See Also:
Collection.contains(Object)
-
toCharArray
char[] toCharArray()
Returns a primitive type array containing the items of this collection.- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray()
-
toCharArray
char[] toCharArray(char[] a)
Returns a primitive type array containing the items of this collection.Note that, contrarily to
Collection.toArray(Object[]), this methods just writes all elements of this collection: no special value will be added after the last one.- Parameters:
a- if this array is big enough, it will be used to store this collection.- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray(Object[])
-
toArray
char[] toArray(char[] a)
Returns a primitive type array containing the items of this collection.Note that, contrarily to
Collection.toArray(Object[]), this methods just writes all elements of this collection: no special value will be added after the last one.- Parameters:
a- if this array is big enough, it will be used to store this collection.- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray(Object[])
-
add
boolean add(char key)
- See Also:
Collection.add(Object)
-
rem
boolean rem(char key)
Note that this method should be calledremove(), but the clash with the similarly named index-based method in theListinterface forces us to use a distinguished name. For simplicity, the set interfaces reinstatesremove().- See Also:
Collection.remove(Object)
-
addAll
boolean addAll(CharCollection c)
- See Also:
Collection.addAll(Collection)
-
containsAll
boolean containsAll(CharCollection c)
- See Also:
Collection.containsAll(Collection)
-
removeAll
boolean removeAll(CharCollection c)
- See Also:
Collection.removeAll(Collection)
-
retainAll
boolean retainAll(CharCollection c)
- See Also:
Collection.retainAll(Collection)
-
-