public abstract class AbstractCharCollection extends Object implements CharCollection
In this implementation, size() is calculated by iterating over the collection. Make sure that size() is overwritten or that iterators do not depend on the size() method.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCharCollection()
Default constructor to be invoked by sub-classes.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(char v)
Throws UnsupportedOperationException.
|
boolean |
addAll(CharCollection c)
Adds all the elements of a specified collection to
this collection.
|
void |
clear()
Clears this collection.
|
boolean |
contains(char v)
Indicates whether this collection contains a specified
element.
|
boolean |
containsAll(CharCollection c)
Indicates whether all elements of a specified
collection is contained in this collection.
|
boolean |
isEmpty()
Indicates whether this collection is empty.
|
boolean |
remove(char v)
Removes a specified element from this collection.
|
boolean |
removeAll(CharCollection c)
Removes all the elements of a specified collection from
this collection.
|
boolean |
retainAll(CharCollection c)
Retains only the elements of a specified collection in
this collection.
|
int |
size()
Returns the number of elements in this collection.
|
char[] |
toArray()
Returns the elements of this collection as an array.
|
char[] |
toArray(char[] a)
Returns the elements of this collection as an array.
|
String |
toString()
Returns a string representation of this collection.
|
void |
trimToSize()
Does nothing.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCode, iteratorprotected AbstractCharCollection()
public boolean add(char v)
add in interface CharCollectionv - the element to add to this collection.UnsupportedOperationException - unconditionally.CharCollection.addAll(CharCollection)public boolean addAll(CharCollection c)
CharCollectionaddAll in interface CharCollectionc - the collection whose elements to add to this
collection.CharCollection.add(char)public void clear()
CharCollectionclear in interface CharCollectionpublic boolean contains(char v)
CharCollectioncontains in interface CharCollectionv - the element to test for containment.CharCollection.containsAll(CharCollection)public boolean containsAll(CharCollection c)
CharCollectioncontainsAll in interface CharCollectionc - the collection whose elements to test for
containment.CharCollection.contains(char)public boolean isEmpty()
CharCollectionisEmpty in interface CharCollectionpublic boolean remove(char v)
CharCollectionremove in interface CharCollectionv - the char value to remove from this collection.public boolean removeAll(CharCollection c)
CharCollectionremoveAll in interface CharCollectionc - the collection whose elements to remove from this
collection.public boolean retainAll(CharCollection c)
CharCollectionretainAll in interface CharCollectionc - the collection whose elements to retain in this
collection.public int size()
CharCollectionsize in interface CharCollectionpublic char[] toArray()
CharCollectiontoArray in interface CharCollectionpublic char[] toArray(char[] a)
CharCollectiontoArray in interface CharCollectiona - an array to fill with the elements of this
collection; if a is null or not
big enough to contain all the elements of this
collection, an new array is allocated,
and a is not changed.public void trimToSize()
trimToSize in interface CharCollectionCopyright © 2011–2025. All rights reserved.