Class ByteSets.Singleton
- java.lang.Object
-
- java.util.AbstractCollection<Byte>
-
- it.unimi.dsi.fastutil.bytes.AbstractByteCollection
-
- it.unimi.dsi.fastutil.bytes.AbstractByteSet
-
- it.unimi.dsi.fastutil.bytes.ByteSets.Singleton
-
- All Implemented Interfaces:
ByteCollection
,ByteIterable
,ByteSet
,Serializable
,Cloneable
,Iterable<Byte>
,Collection<Byte>
,Set<Byte>
- Direct Known Subclasses:
ByteSortedSets.Singleton
- Enclosing class:
- ByteSets
public static class ByteSets.Singleton extends AbstractByteSet implements Serializable, Cloneable
An immutable class representing a type-specific singleton set.This class may be useful to implement your own in case you subclass a type-specific set.
- See Also:
- Serialized Form
-
-
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)
Object
clone()
boolean
contains(byte k)
Returnstrue
if this collection contains the specified element.ByteListIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
remove(byte k)
Removes an element from this set.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()
-
Methods inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteSet
equals, hashCode, rem
-
Methods inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteCollection
add, add, contains, containsAll, containsAll, remove, toArray, toByteArray, toByteArray, toString
-
Methods inherited from class java.util.AbstractCollection
clear, isEmpty, toArray, toArray
-
Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteCollection
add, containsAll, removeIf, removeIf, toArray, toByteArray, toByteArray
-
Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteIterable
forEach, forEach
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, spliterator, 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)
-
remove
public boolean remove(byte k)
Description copied from class:AbstractByteSet
Removes an element from this set.Note that the corresponding method of a type-specific collection is
rem()
. This unfortunate situation is caused by the clash with the similarly named index-based method in theList
interface. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass.- Specified by:
remove
in interfaceByteSet
- Overrides:
remove
in classAbstractByteSet
- See Also:
Collection.remove(Object)
-
iterator
public ByteListIterator 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 interfaceByteSet
- Specified by:
iterator
in interfaceCollection<Byte>
- Specified by:
iterator
in interfaceIterable<Byte>
- Specified by:
iterator
in interfaceSet<Byte>
- Specified by:
iterator
in classAbstractByteSet
- 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 interfaceSet<Byte>
- Specified by:
size
in classAbstractCollection<Byte>
-
addAll
public boolean addAll(Collection<? extends Byte> c)
Description copied from class:AbstractByteCollection
This implementation delegates to the type-specific version if given a type-specific collection, otherwise is uses the implementation from
AbstractCollection
.- Specified by:
addAll
in interfaceCollection<Byte>
- Specified by:
addAll
in interfaceSet<Byte>
- Overrides:
addAll
in classAbstractByteCollection
-
removeAll
public boolean removeAll(Collection<?> c)
Description copied from class:AbstractByteCollection
This implementation delegates to the type-specific version if given a type-specific collection, otherwise is uses the implementation from
AbstractCollection
.- Specified by:
removeAll
in interfaceCollection<Byte>
- Specified by:
removeAll
in interfaceSet<Byte>
- Overrides:
removeAll
in classAbstractByteCollection
-
retainAll
public boolean retainAll(Collection<?> c)
Description copied from class:AbstractByteCollection
This implementation delegates to the type-specific version if given a type-specific collection, otherwise is uses the implementation from
AbstractCollection
.- Specified by:
retainAll
in interfaceCollection<Byte>
- Specified by:
retainAll
in interfaceSet<Byte>
- Overrides:
retainAll
in classAbstractByteCollection
-
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)
-
clone
public Object clone()
-
-