public abstract static class ShortCollections.EmptyCollection extends AbstractShortCollection
This class may be useful to implement your own in case you subclass a type-specific collection.
Modifier and Type | Method and Description |
---|---|
boolean |
add(short k) |
boolean |
addAll(ShortCollection c)
Adds all elements of the given type-specific collection to this collection.
|
void |
clear() |
boolean |
contains(short k) |
boolean |
containsAll(ShortCollection c)
Checks whether this collection contains all elements from the given type-specific collection.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
ShortBidirectionalIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
boolean |
rem(short k)
Note that this method should be called
remove() , but the clash
with the similarly named index-based method in the List interface
forces us to use a distinguished name. |
boolean |
removeAll(ShortCollection c)
Remove from this collection all elements in the given type-specific collection.
|
boolean |
retainAll(ShortCollection c)
Retains in this collection only elements from the given type-specific collection.
|
int |
size() |
java.lang.Object[] |
toArray() |
short[] |
toShortArray()
Returns a primitive type array containing the items of this collection.
|
short[] |
toShortArray(short[] a)
Returns a primitive type array containing the items of this collection.
|
add, addAll, contains, containsAll, isEmpty, rem, remove, removeAll, retainAll, shortIterator, toArray, toArray, toString
public boolean add(short k)
add
in interface ShortCollection
add
in class AbstractShortCollection
Collection.add(Object)
public boolean contains(short k)
contains
in interface ShortCollection
contains
in class AbstractShortCollection
Collection.contains(Object)
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<java.lang.Short>
toArray
in class AbstractShortCollection
public short[] toShortArray(short[] a)
ShortCollection
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.
toShortArray
in interface ShortCollection
toShortArray
in class AbstractShortCollection
a
- if this array is big enough, it will be used to store this collection.Collection.toArray(Object[])
public short[] toShortArray()
ShortCollection
toShortArray
in interface ShortCollection
toShortArray
in class AbstractShortCollection
Collection.toArray()
public boolean rem(short k)
ShortCollection
remove()
, but the clash
with the similarly named index-based method in the List
interface
forces us to use a distinguished name. For simplicity, the set interfaces reinstates
remove()
.rem
in interface ShortCollection
rem
in class AbstractShortCollection
Collection.remove(Object)
public boolean addAll(ShortCollection c)
AbstractShortCollection
addAll
in interface ShortCollection
addAll
in class AbstractShortCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.addAll(Collection)
public boolean removeAll(ShortCollection c)
AbstractShortCollection
removeAll
in interface ShortCollection
removeAll
in class AbstractShortCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.removeAll(Collection)
public boolean retainAll(ShortCollection c)
AbstractShortCollection
retainAll
in interface ShortCollection
retainAll
in class AbstractShortCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.retainAll(Collection)
public boolean containsAll(ShortCollection c)
AbstractShortCollection
containsAll
in interface ShortCollection
containsAll
in class AbstractShortCollection
c
- a type-specific collection.true
if this collection contains all elements of the argument.Collection.containsAll(Collection)
public ShortBidirectionalIterator iterator()
ShortCollection
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 extends Collection
.
iterator
in interface ShortCollection
iterator
in interface ShortIterable
iterator
in interface java.lang.Iterable<java.lang.Short>
iterator
in interface java.util.Collection<java.lang.Short>
iterator
in class AbstractShortCollection
public int size()
size
in interface java.util.Collection<java.lang.Short>
size
in class java.util.AbstractCollection<java.lang.Short>
public void clear()
clear
in interface java.util.Collection<java.lang.Short>
clear
in class java.util.AbstractCollection<java.lang.Short>
public int hashCode()
hashCode
in interface java.util.Collection<java.lang.Short>
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection<java.lang.Short>
equals
in class java.lang.Object