Package it.unimi.dsi.fastutil.chars
Class CharCollections.EmptyCollection
- java.lang.Object
-
- java.util.AbstractCollection<Character>
-
- it.unimi.dsi.fastutil.chars.AbstractCharCollection
-
- it.unimi.dsi.fastutil.chars.CharCollections.EmptyCollection
-
- All Implemented Interfaces:
CharCollection
,CharIterable
,Iterable<Character>
,Collection<Character>
- Direct Known Subclasses:
CharBigLists.EmptyBigList
,CharLists.EmptyList
,CharSets.EmptySet
- Enclosing class:
- CharCollections
public abstract static class CharCollections.EmptyCollection extends AbstractCharCollection
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(CharCollection c)
Adds all elements of the given type-specific collection to this collection.boolean
addAll(Collection<? extends Character> c)
void
clear()
boolean
contains(char k)
Returnstrue
if this collection contains the specified element.boolean
equals(Object o)
int
hashCode()
CharBidirectionalIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
removeAll(CharCollection c)
Remove from this collection all elements in the given type-specific collection.boolean
removeAll(Collection<?> c)
boolean
retainAll(CharCollection 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.chars.AbstractCharCollection
add, add, contains, containsAll, rem, remove, toArray, toCharArray, toCharArray, toString
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toArray
-
Methods inherited from interface it.unimi.dsi.fastutil.chars.CharCollection
removeIf, removeIf
-
Methods inherited from interface it.unimi.dsi.fastutil.chars.CharIterable
forEach, forEach
-
Methods inherited from interface java.util.Collection
containsAll, isEmpty, parallelStream, spliterator, stream, toArray, toArray
-
-
-
-
Method Detail
-
contains
public boolean contains(char k)
Description copied from class:AbstractCharCollection
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 interfaceCharCollection
- Overrides:
contains
in classAbstractCharCollection
- See Also:
Collection.contains(Object)
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<Character>
- Overrides:
toArray
in classAbstractCollection<Character>
-
iterator
public CharBidirectionalIterator iterator()
Description copied from interface:CharCollection
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 interfaceCharCollection
- Specified by:
iterator
in interfaceCharIterable
- Specified by:
iterator
in interfaceCollection<Character>
- Specified by:
iterator
in interfaceIterable<Character>
- Specified by:
iterator
in classAbstractCharCollection
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
size
public int size()
- Specified by:
size
in interfaceCollection<Character>
- Specified by:
size
in classAbstractCollection<Character>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<Character>
- Overrides:
clear
in classAbstractCollection<Character>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<Character>
- Overrides:
hashCode
in classObject
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<Character>
- Overrides:
equals
in classObject
-
addAll
public boolean addAll(Collection<? extends Character> c)
- Specified by:
addAll
in interfaceCollection<Character>
- Overrides:
addAll
in classAbstractCollection<Character>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<Character>
- Overrides:
removeAll
in classAbstractCollection<Character>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<Character>
- Overrides:
retainAll
in classAbstractCollection<Character>
-
addAll
public boolean addAll(CharCollection c)
Description copied from interface:CharCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceCharCollection
- Overrides:
addAll
in classAbstractCharCollection
- 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(CharCollection c)
Description copied from interface:CharCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceCharCollection
- Overrides:
removeAll
in classAbstractCharCollection
- 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(CharCollection c)
Description copied from interface:CharCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceCharCollection
- Overrides:
retainAll
in classAbstractCharCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
-