Package it.unimi.dsi.fastutil.bytes
Class ByteCollections.EmptyCollection
- java.lang.Object
-
- java.util.AbstractCollection<Byte>
-
- it.unimi.dsi.fastutil.bytes.AbstractByteCollection
-
- it.unimi.dsi.fastutil.bytes.ByteCollections.EmptyCollection
-
- All Implemented Interfaces:
ByteCollection
,ByteIterable
,Iterable<Byte>
,Collection<Byte>
- Direct Known Subclasses:
ByteBigLists.EmptyBigList
,ByteLists.EmptyList
,ByteSets.EmptySet
- Enclosing class:
- ByteCollections
public abstract static class ByteCollections.EmptyCollection extends AbstractByteCollection
An immutable class representing an empty type-specific collection.This class may be useful to implement your own in case you subclass a type-specific collection.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addAll(ByteCollection c)
Adds all elements of the given type-specific collection to this collection.boolean
addAll(Collection<? extends Byte> c)
void
clear()
boolean
contains(byte k)
Returnstrue
if this collection contains the specified element.boolean
equals(Object o)
int
hashCode()
ByteBidirectionalIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
removeAll(ByteCollection c)
Remove from this collection all elements in the given type-specific collection.boolean
removeAll(Collection<?> c)
boolean
retainAll(ByteCollection c)
Retains in this collection only elements from the given type-specific collection.boolean
retainAll(Collection<?> c)
int
size()
Object[]
toArray()
-
Methods inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteCollection
add, add, contains, containsAll, rem, remove, toArray, toByteArray, toByteArray, toString
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toArray
-
Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteCollection
removeIf, removeIf
-
Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteIterable
forEach, forEach
-
Methods inherited from interface java.util.Collection
containsAll, isEmpty, parallelStream, spliterator, stream, toArray, toArray
-
-
-
-
Method Detail
-
contains
public boolean contains(byte k)
Description copied from class:AbstractByteCollection
Returnstrue
if this collection contains the specified element.This implementation iterates over the elements in the collection, looking for the specified element.
- Specified by:
contains
in interfaceByteCollection
- Overrides:
contains
in classAbstractByteCollection
- See Also:
Collection.contains(Object)
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<Byte>
- Overrides:
toArray
in classAbstractCollection<Byte>
-
iterator
public ByteBidirectionalIterator iterator()
Description copied from interface:ByteCollection
Returns 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:
iterator
in interfaceByteCollection
- Specified by:
iterator
in interfaceByteIterable
- Specified by:
iterator
in interfaceCollection<Byte>
- Specified by:
iterator
in interfaceIterable<Byte>
- Specified by:
iterator
in classAbstractByteCollection
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
size
public int size()
- Specified by:
size
in interfaceCollection<Byte>
- Specified by:
size
in classAbstractCollection<Byte>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<Byte>
- Overrides:
clear
in classAbstractCollection<Byte>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<Byte>
- Overrides:
hashCode
in classObject
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<Byte>
- Overrides:
equals
in classObject
-
addAll
public boolean addAll(Collection<? extends Byte> c)
- Specified by:
addAll
in interfaceCollection<Byte>
- Overrides:
addAll
in classAbstractCollection<Byte>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<Byte>
- Overrides:
removeAll
in classAbstractCollection<Byte>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<Byte>
- Overrides:
retainAll
in classAbstractCollection<Byte>
-
addAll
public boolean addAll(ByteCollection c)
Description copied from interface:ByteCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceByteCollection
- Overrides:
addAll
in classAbstractByteCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.addAll(Collection)
-
removeAll
public boolean removeAll(ByteCollection c)
Description copied from interface:ByteCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceByteCollection
- Overrides:
removeAll
in classAbstractByteCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.removeAll(Collection)
-
retainAll
public boolean retainAll(ByteCollection c)
Description copied from interface:ByteCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceByteCollection
- Overrides:
retainAll
in classAbstractByteCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
-