Package it.unimi.dsi.fastutil.bytes
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
Modifier and Type Method Description booleanaddAll(ByteCollection c)Adds all elements of the given type-specific collection to this collection.booleanaddAll(Collection<? extends Byte> c)Objectclone()booleancontains(byte k)Returnstrueif this collection contains the specified element.ByteListIteratoriterator()Returns a type-specific iterator on the elements of this collection.booleanremove(byte k)Removes an element from this set.booleanremoveAll(ByteCollection c)Remove from this collection all elements in the given type-specific collection.booleanremoveAll(Collection<?> c)booleanretainAll(ByteCollection c)Retains in this collection only elements from the given type-specific collection.booleanretainAll(Collection<?> c)intsize()-
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, remove, toArray, toByteArray, toByteArray, toString
-
Methods inherited from class java.util.AbstractCollection
clear, containsAll, 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:AbstractByteCollectionReturnstrueif this collection contains the specified element.This implementation iterates over the elements in the collection, looking for the specified element.
- Specified by:
containsin interfaceByteCollection- Overrides:
containsin classAbstractByteCollection- See Also:
Collection.contains(Object)
-
remove
public boolean remove(byte k)
Description copied from class:AbstractByteSetRemoves 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 theListinterface. Delegates to the type-specificrem()method implemented by type-specific abstractCollectionsuperclass.- Specified by:
removein interfaceByteSet- Overrides:
removein classAbstractByteSet- See Also:
Collection.remove(Object)
-
iterator
public ByteListIterator iterator()
Description copied from interface:ByteCollectionReturns 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:
iteratorin interfaceByteCollection- Specified by:
iteratorin interfaceByteIterable- Specified by:
iteratorin interfaceByteSet- Specified by:
iteratorin interfaceCollection<Byte>- Specified by:
iteratorin interfaceIterable<Byte>- Specified by:
iteratorin interfaceSet<Byte>- Specified by:
iteratorin classAbstractByteSet- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
size
public int size()
- Specified by:
sizein interfaceCollection<Byte>- Specified by:
sizein interfaceSet<Byte>- Specified by:
sizein classAbstractCollection<Byte>
-
addAll
public boolean addAll(Collection<? extends Byte> c)
- Specified by:
addAllin interfaceCollection<Byte>- Specified by:
addAllin interfaceSet<Byte>- Overrides:
addAllin classAbstractCollection<Byte>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<Byte>- Specified by:
removeAllin interfaceSet<Byte>- Overrides:
removeAllin classAbstractCollection<Byte>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<Byte>- Specified by:
retainAllin interfaceSet<Byte>- Overrides:
retainAllin classAbstractCollection<Byte>
-
addAll
public boolean addAll(ByteCollection c)
Description copied from interface:ByteCollectionAdds all elements of the given type-specific collection to this collection.- Specified by:
addAllin interfaceByteCollection- Overrides:
addAllin classAbstractByteCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.addAll(Collection)
-
removeAll
public boolean removeAll(ByteCollection c)
Description copied from interface:ByteCollectionRemove from this collection all elements in the given type-specific collection.- Specified by:
removeAllin interfaceByteCollection- Overrides:
removeAllin classAbstractByteCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.removeAll(Collection)
-
retainAll
public boolean retainAll(ByteCollection c)
Description copied from interface:ByteCollectionRetains in this collection only elements from the given type-specific collection.- Specified by:
retainAllin interfaceByteCollection- Overrides:
retainAllin classAbstractByteCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
clone
public Object clone()
-
-