public abstract static class ByteCollections.EmptyCollection extends AbstractByteCollection
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(byte k) |
boolean |
addAll(ByteCollection c)
Adds all elements of the given type-specific collection to this collection.
|
void |
clear() |
boolean |
contains(byte k) |
boolean |
containsAll(ByteCollection c)
Checks whether this collection contains all elements from the given type-specific collection.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
ByteBidirectionalIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
boolean |
rem(byte 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(ByteCollection c)
Remove from this collection all elements in the given type-specific collection.
|
boolean |
retainAll(ByteCollection c)
Retains in this collection only elements from the given type-specific collection.
|
int |
size() |
java.lang.Object[] |
toArray() |
byte[] |
toByteArray()
Returns a primitive type array containing the items of this collection.
|
byte[] |
toByteArray(byte[] a)
Returns a primitive type array containing the items of this collection.
|
add, addAll, byteIterator, contains, containsAll, isEmpty, rem, remove, removeAll, retainAll, toArray, toArray, toString
public boolean add(byte k)
add
in interface ByteCollection
add
in class AbstractByteCollection
Collection.add(Object)
public boolean contains(byte k)
contains
in interface ByteCollection
contains
in class AbstractByteCollection
Collection.contains(Object)
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<java.lang.Byte>
toArray
in class AbstractByteCollection
public byte[] toByteArray(byte[] a)
ByteCollection
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.
toByteArray
in interface ByteCollection
toByteArray
in class AbstractByteCollection
a
- if this array is big enough, it will be used to store this collection.Collection.toArray(Object[])
public byte[] toByteArray()
ByteCollection
toByteArray
in interface ByteCollection
toByteArray
in class AbstractByteCollection
Collection.toArray()
public boolean rem(byte k)
ByteCollection
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 ByteCollection
rem
in class AbstractByteCollection
Collection.remove(Object)
public boolean addAll(ByteCollection c)
AbstractByteCollection
addAll
in interface ByteCollection
addAll
in class AbstractByteCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.addAll(Collection)
public boolean removeAll(ByteCollection c)
AbstractByteCollection
removeAll
in interface ByteCollection
removeAll
in class AbstractByteCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.removeAll(Collection)
public boolean retainAll(ByteCollection c)
AbstractByteCollection
retainAll
in interface ByteCollection
retainAll
in class AbstractByteCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.retainAll(Collection)
public boolean containsAll(ByteCollection c)
AbstractByteCollection
containsAll
in interface ByteCollection
containsAll
in class AbstractByteCollection
c
- a type-specific collection.true
if this collection contains all elements of the argument.Collection.containsAll(Collection)
public ByteBidirectionalIterator iterator()
ByteCollection
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 ByteCollection
iterator
in interface ByteIterable
iterator
in interface java.lang.Iterable<java.lang.Byte>
iterator
in interface java.util.Collection<java.lang.Byte>
iterator
in class AbstractByteCollection
public int size()
size
in interface java.util.Collection<java.lang.Byte>
size
in class java.util.AbstractCollection<java.lang.Byte>
public void clear()
clear
in interface java.util.Collection<java.lang.Byte>
clear
in class java.util.AbstractCollection<java.lang.Byte>
public int hashCode()
hashCode
in interface java.util.Collection<java.lang.Byte>
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection<java.lang.Byte>
equals
in class java.lang.Object