Package it.unimi.dsi.fastutil.objects
Class ObjectCollections.UnmodifiableCollection<K>
- java.lang.Object
-
- it.unimi.dsi.fastutil.objects.ObjectCollections.UnmodifiableCollection<K>
-
- All Implemented Interfaces:
ObjectCollection<K>
,ObjectIterable<K>
,Serializable
,Iterable<K>
,Collection<K>
- Direct Known Subclasses:
ObjectBigLists.UnmodifiableBigList
,ObjectLists.UnmodifiableList
,ObjectSets.UnmodifiableSet
- Enclosing class:
- ObjectCollections
public static class ObjectCollections.UnmodifiableCollection<K> extends Object implements ObjectCollection<K>, Serializable
An unmodifiable wrapper class for collections.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(K k)
boolean
addAll(Collection<? extends K> c)
void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
equals(Object o)
int
hashCode()
boolean
isEmpty()
ObjectIterator<K>
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
remove(Object k)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
Object[]
toArray()
<T> T[]
toArray(T[] a)
String
toString()
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Method Detail
-
add
public boolean add(K k)
- Specified by:
add
in interfaceCollection<K>
-
remove
public boolean remove(Object k)
- Specified by:
remove
in interfaceCollection<K>
-
size
public int size()
- Specified by:
size
in interfaceCollection<K>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<K>
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<K>
-
iterator
public ObjectIterator<K> iterator()
Description copied from interface:ObjectCollection
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 interfaceCollection<K>
- Specified by:
iterator
in interfaceIterable<K>
- Specified by:
iterator
in interfaceObjectCollection<K>
- Specified by:
iterator
in interfaceObjectIterable<K>
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<K>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfaceCollection<K>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<K>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<K>
-
addAll
public boolean addAll(Collection<? extends K> c)
- Specified by:
addAll
in interfaceCollection<K>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<K>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<K>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<K>
- Overrides:
hashCode
in classObject
-
-