Class LongCollections.UnmodifiableCollection
- java.lang.Object
-
- it.unimi.dsi.fastutil.longs.LongCollections.UnmodifiableCollection
-
- All Implemented Interfaces:
LongCollection
,LongIterable
,Serializable
,Iterable<Long>
,Collection<Long>
- Direct Known Subclasses:
LongBigLists.UnmodifiableBigList
,LongLists.UnmodifiableList
,LongSets.UnmodifiableSet
- Enclosing class:
- LongCollections
public static class LongCollections.UnmodifiableCollection extends Object implements LongCollection, Serializable
An unmodifiable wrapper class for collections.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
add(long k)
Ensures that this collection contains the specified element (optional operation).boolean
add(Long k)
Deprecated.boolean
addAll(LongCollection c)
Adds all elements of the given type-specific collection to this collection.boolean
addAll(Collection<? extends Long> c)
void
clear()
boolean
contains(long o)
Returnstrue
if this collection contains the specified element.boolean
contains(Object k)
Deprecated.boolean
containsAll(LongCollection c)
Checks whether this collection contains all elements from the given type-specific collection.boolean
containsAll(Collection<?> c)
boolean
equals(Object o)
int
hashCode()
boolean
isEmpty()
LongIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
rem(long k)
Removes a single instance of the specified element from this collection, if it is present (optional operation).boolean
remove(Object k)
Deprecated.boolean
removeAll(LongCollection c)
Remove from this collection all elements in the given type-specific collection.boolean
removeAll(Collection<?> c)
boolean
retainAll(LongCollection c)
Retains in this collection only elements from the given type-specific collection.boolean
retainAll(Collection<?> c)
int
size()
Object[]
toArray()
long[]
toArray(long[] a)
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.<T> T[]
toArray(T[] a)
long[]
toLongArray()
Returns a primitive type array containing the items of this collection.long[]
toLongArray(long[] a)
Deprecated.String
toString()
-
Methods inherited from interface java.util.Collection
parallelStream, spliterator, stream, toArray
-
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection
removeIf, removeIf
-
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongIterable
forEach, forEach
-
-
-
-
Method Detail
-
add
public boolean add(long k)
Description copied from interface:LongCollection
Ensures that this collection contains the specified element (optional operation).- Specified by:
add
in interfaceLongCollection
- See Also:
Collection.add(Object)
-
rem
public boolean rem(long k)
Description copied from interface:LongCollection
Removes a single instance of the specified element from this collection, if it is present (optional operation).Note that this method should be called
remove()
, but the clash with the similarly named index-based method in theList
interface forces us to use a distinguished name. For simplicity, the set interfaces reinstatesremove()
.- Specified by:
rem
in interfaceLongCollection
- See Also:
Collection.remove(Object)
-
size
public int size()
- Specified by:
size
in interfaceCollection<Long>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<Long>
-
contains
public boolean contains(long o)
Description copied from interface:LongCollection
Returnstrue
if this collection contains the specified element.- Specified by:
contains
in interfaceLongCollection
- See Also:
Collection.contains(Object)
-
iterator
public LongIterator iterator()
Description copied from interface:LongCollection
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<Long>
- Specified by:
iterator
in interfaceIterable<Long>
- Specified by:
iterator
in interfaceLongCollection
- Specified by:
iterator
in interfaceLongIterable
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<Long>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfaceCollection<Long>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<Long>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<Long>
-
addAll
public boolean addAll(Collection<? extends Long> c)
- Specified by:
addAll
in interfaceCollection<Long>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<Long>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<Long>
-
add
@Deprecated public boolean add(Long k)
Deprecated.Description copied from interface:LongCollection
- Specified by:
add
in interfaceCollection<Long>
- Specified by:
add
in interfaceLongCollection
-
contains
@Deprecated public boolean contains(Object k)
Deprecated.Description copied from interface:LongCollection
- Specified by:
contains
in interfaceCollection<Long>
- Specified by:
contains
in interfaceLongCollection
-
remove
@Deprecated public boolean remove(Object k)
Deprecated.Description copied from interface:LongCollection
- Specified by:
remove
in interfaceCollection<Long>
- Specified by:
remove
in interfaceLongCollection
-
toLongArray
public long[] toLongArray()
Description copied from interface:LongCollection
Returns a primitive type array containing the items of this collection.- Specified by:
toLongArray
in interfaceLongCollection
- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray()
-
toLongArray
@Deprecated public long[] toLongArray(long[] a)
Deprecated.Description copied from interface:LongCollection
Returns a primitive type array containing the items of this collection.Note that, contrarily to
Collection.toArray(Object[])
, this methods just writes all elements of this collection: no special value will be added after the last one.- Specified by:
toLongArray
in interfaceLongCollection
- Parameters:
a
- if this array is big enough, it will be used to store this collection.- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray(Object[])
-
toArray
public long[] toArray(long[] a)
Description copied from interface:LongCollection
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.Note that, contrarily to
Collection.toArray(Object[])
, this methods just writes all elements of this collection: no special value will be added after the last one.- Specified by:
toArray
in interfaceLongCollection
- Parameters:
a
- if this array is big enough, it will be used to store this collection.- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray(Object[])
-
containsAll
public boolean containsAll(LongCollection c)
Description copied from interface:LongCollection
Checks whether this collection contains all elements from the given type-specific collection.- Specified by:
containsAll
in interfaceLongCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection contains all elements of the argument.- See Also:
Collection.containsAll(Collection)
-
addAll
public boolean addAll(LongCollection c)
Description copied from interface:LongCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceLongCollection
- 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(LongCollection c)
Description copied from interface:LongCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceLongCollection
- 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(LongCollection c)
Description copied from interface:LongCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceLongCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<Long>
- Overrides:
hashCode
in classObject
-
-