|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bak.pcj.AbstractShortCollection
This class represents an abstract base for implementing collections of short values. All operations that can be implemented using iterators are implemented as such. In most cases, this is hardly an efficient solution, and at least some of those methods should be overridden by sub-classes.
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.
Constructor Summary | |
protected |
AbstractShortCollection()
Default constructor to be invoked by sub-classes. |
Method Summary | |
boolean |
add(short v)
Throws UnsupportedOperationException. |
boolean |
addAll(ShortCollection c)
Adds all the elements of a specified collection to this collection. |
void |
clear()
Clears this collection. |
boolean |
contains(short v)
Indicates whether this collection contains a specified element. |
boolean |
containsAll(ShortCollection c)
Indicates whether all elements of a specified collection is contained in this collection. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
boolean |
remove(short v)
Removes a specified element from this collection. |
boolean |
removeAll(ShortCollection c)
Removes all the elements of a specified collection from this collection. |
boolean |
retainAll(ShortCollection c)
Retains only the elements of a specified collection in this collection. |
int |
size()
Returns the number of elements in this collection. |
short[] |
toArray()
Returns the elements of this collection as an array. |
short[] |
toArray(short[] a)
Returns the elements of this collection as an array. |
String |
toString()
Returns a string representation of this collection. |
void |
trimToSize()
Does nothing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface bak.pcj.ShortCollection |
equals, hashCode, iterator |
Constructor Detail |
protected AbstractShortCollection()
Method Detail |
public boolean add(short v)
add
in interface ShortCollection
v
- the element to add to this collection.
UnsupportedOperationException
- unconditionally.ShortCollection.addAll(ShortCollection)
public boolean addAll(ShortCollection c)
ShortCollection
addAll
in interface ShortCollection
c
- the collection whose elements to add to this
collection.
ShortCollection.add(short)
public void clear()
ShortCollection
clear
in interface ShortCollection
public boolean contains(short v)
ShortCollection
contains
in interface ShortCollection
v
- the element to test for containment.
ShortCollection.containsAll(ShortCollection)
public boolean containsAll(ShortCollection c)
ShortCollection
containsAll
in interface ShortCollection
c
- the collection whose elements to test for
containment.
ShortCollection.contains(short)
public boolean isEmpty()
ShortCollection
isEmpty
in interface ShortCollection
public boolean remove(short v)
ShortCollection
remove
in interface ShortCollection
v
- the short value to remove from this collection.
public boolean removeAll(ShortCollection c)
ShortCollection
removeAll
in interface ShortCollection
c
- the collection whose elements to remove from this
collection.
public boolean retainAll(ShortCollection c)
ShortCollection
retainAll
in interface ShortCollection
c
- the collection whose elements to retain in this
collection.
public int size()
ShortCollection
size
in interface ShortCollection
public short[] toArray()
ShortCollection
toArray
in interface ShortCollection
public short[] toArray(short[] a)
ShortCollection
toArray
in interface ShortCollection
a
- 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 ShortCollection
public String toString()
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |