Class AbstractCharCollection
- java.lang.Object
-
- java.util.AbstractCollection<Character>
-
- org.codelibs.jhighlight.fastutil.chars.AbstractCharCollection
-
- All Implemented Interfaces:
Iterable<Character>,Collection<Character>,CharCollection,CharIterable
- Direct Known Subclasses:
AbstractCharList,AbstractCharSet
public abstract class AbstractCharCollection extends AbstractCollection<Character> implements CharCollection
An abstract class providing basic methods for collections implementing a type-specific interface.In particular, this class provide
iterator(),add(),remove(Object)andcontains(Object)methods that just call the type-specific counterpart.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCharCollection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanadd(char k)booleanadd(Character o)Delegates to the corresponding type-specific method.booleanaddAll(Collection<? extends Character> c)Adds all elements of the given collection to this collection.booleanaddAll(CharCollection c)Adds all elements of the given type-specific collection to this collection.CharIteratorcharIterator()Deprecated.booleancontains(char k)booleancontains(Object o)Delegates to the corresponding type-specific method.booleancontainsAll(Collection<?> c)Checks whether this collection contains all elements from the given collection.booleancontainsAll(CharCollection c)Checks whether this collection contains all elements from the given type-specific collection.booleanisEmpty()abstract CharIteratoriterator()Returns a type-specific iterator on the elements of this collection.booleanrem(char k)booleanrem(Object o)Delegates to the corresponding type-specific method.booleanremove(Object ok)Delegates to the type-specificrem()method.booleanremoveAll(Collection<?> c)Remove from this collection all elements in the given collection.booleanremoveAll(CharCollection c)Remove from this collection all elements in the given type-specific collection.booleanretainAll(Collection<?> c)Retains in this collection only elements from the given collection.booleanretainAll(CharCollection c)Retains in this collection only elements from the given type-specific collection.Object[]toArray()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.StringtoString()-
Methods inherited from class java.util.AbstractCollection
clear, size
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
clear, equals, hashCode, parallelStream, removeIf, size, spliterator, stream, toArray
-
-
-
-
Method Detail
-
toArray
public char[] toArray(char[] a)
Description copied from interface:CharCollectionReturns 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.- Specified by:
toArrayin interfaceCharCollection- 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[])
-
toCharArray
public char[] toCharArray()
Description copied from interface:CharCollectionReturns a primitive type array containing the items of this collection.- Specified by:
toCharArrayin interfaceCharCollection- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray()
-
toCharArray
public char[] toCharArray(char[] a)
Description copied from interface:CharCollectionReturns 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.- Specified by:
toCharArrayin interfaceCharCollection- 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[])
-
addAll
public boolean addAll(CharCollection c)
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAllin interfaceCharCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.addAll(Collection)
-
containsAll
public boolean containsAll(CharCollection c)
Checks whether this collection contains all elements from the given type-specific collection.- Specified by:
containsAllin interfaceCharCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection contains all elements of the argument.- See Also:
Collection.containsAll(Collection)
-
retainAll
public boolean retainAll(CharCollection c)
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAllin interfaceCharCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
removeAll
public boolean removeAll(CharCollection c)
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAllin interfaceCharCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.removeAll(Collection)
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<Character>- Overrides:
toArrayin classAbstractCollection<Character>
-
toArray
public <T> T[] toArray(T[] a)
Description copied from interface:CharCollectionReturns 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 interfaceCharCollection- Specified by:
toArrayin interfaceCollection<Character>- Overrides:
toArrayin classAbstractCollection<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[])
-
addAll
public boolean addAll(Collection<? extends Character> c)
Adds all elements of the given collection to this collection.- Specified by:
addAllin interfaceCollection<Character>- Overrides:
addAllin classAbstractCollection<Character>- Parameters:
c- a collection.- Returns:
trueif this collection changed as a result of the call.
-
add
public boolean add(char k)
- Specified by:
addin interfaceCharCollection- See Also:
Collection.add(Object)
-
charIterator
@Deprecated public CharIterator charIterator()
Deprecated.Delegates to the new covariantly stronger generic method.- Specified by:
charIteratorin interfaceCharCollection- See Also:
CharCollection.iterator()
-
iterator
public abstract CharIterator iterator()
Description copied from interface:CharCollectionReturns 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 interfaceCharCollection- Specified by:
iteratorin interfaceCharIterable- Specified by:
iteratorin interfaceCollection<Character>- Specified by:
iteratorin interfaceIterable<Character>- Specified by:
iteratorin classAbstractCollection<Character>- Returns:
- a type-specific iterator on the elements of this collection.
-
remove
public boolean remove(Object ok)
Delegates to the type-specificrem()method.- Specified by:
removein interfaceCollection<Character>- Overrides:
removein classAbstractCollection<Character>
-
add
public boolean add(Character o)
Delegates to the corresponding type-specific method.- Specified by:
addin interfaceCollection<Character>- Overrides:
addin classAbstractCollection<Character>
-
rem
public boolean rem(Object o)
Delegates to the corresponding type-specific method.
-
contains
public boolean contains(Object o)
Delegates to the corresponding type-specific method.- Specified by:
containsin interfaceCollection<Character>- Overrides:
containsin classAbstractCollection<Character>
-
contains
public boolean contains(char k)
- Specified by:
containsin interfaceCharCollection- See Also:
Collection.contains(Object)
-
rem
public boolean rem(char k)
Description copied from interface:CharCollectionNote 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().- Specified by:
remin interfaceCharCollection- See Also:
Collection.remove(Object)
-
containsAll
public boolean containsAll(Collection<?> c)
Checks whether this collection contains all elements from the given collection.- Specified by:
containsAllin interfaceCollection<Character>- Overrides:
containsAllin classAbstractCollection<Character>- Parameters:
c- a collection.- Returns:
trueif this collection contains all elements of the argument.
-
retainAll
public boolean retainAll(Collection<?> c)
Retains in this collection only elements from the given collection.- Specified by:
retainAllin interfaceCollection<Character>- Overrides:
retainAllin classAbstractCollection<Character>- Parameters:
c- a collection.- Returns:
trueif this collection changed as a result of the call.
-
removeAll
public boolean removeAll(Collection<?> c)
Remove from this collection all elements in the given collection. If the collection is an instance of this class, it uses faster iterators.- Specified by:
removeAllin interfaceCollection<Character>- Overrides:
removeAllin classAbstractCollection<Character>- Parameters:
c- a collection.- Returns:
trueif this collection changed as a result of the call.
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<Character>- Overrides:
isEmptyin classAbstractCollection<Character>
-
toString
public String toString()
- Overrides:
toStringin classAbstractCollection<Character>
-
-