Class IntCollections.UnmodifiableCollection
- All Implemented Interfaces:
IntCollection
,IntIterable
,Serializable
,Iterable<Integer>
,Collection<Integer>
- Direct Known Subclasses:
IntBigLists.UnmodifiableBigList
,IntLists.UnmodifiableList
,IntSets.UnmodifiableSet
- Enclosing class:
- IntCollections
public static class IntCollections.UnmodifiableCollection extends Object implements IntCollection, Serializable
- See Also:
- Serialized Form
-
Method Summary
Modifier and Type Method Description boolean
add(int k)
Ensures that this collection contains the specified element (optional operation).boolean
add(Integer k)
Deprecated.boolean
addAll(IntCollection c)
Adds all elements of the given type-specific collection to this collection.boolean
addAll(Collection<? extends Integer> c)
void
clear()
boolean
contains(int o)
Returnstrue
if this collection contains the specified element.boolean
contains(Object k)
Deprecated.boolean
containsAll(IntCollection 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()
IntIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
rem(int 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(IntCollection c)
Remove from this collection all elements in the given type-specific collection.boolean
removeAll(Collection<?> c)
boolean
retainAll(IntCollection c)
Retains in this collection only elements from the given type-specific collection.boolean
retainAll(Collection<?> c)
int
size()
Object[]
toArray()
int[]
toArray(int[] 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)
int[]
toIntArray()
Returns a primitive type array containing the items of this collection.int[]
toIntArray(int[] a)
Deprecated.String
toString()
-
Method Details
-
add
public boolean add(int k)Description copied from interface:IntCollection
Ensures that this collection contains the specified element (optional operation).- Specified by:
add
in interfaceIntCollection
- See Also:
Collection.add(Object)
-
rem
public boolean rem(int k)Description copied from interface:IntCollection
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 interfaceIntCollection
- See Also:
Collection.remove(Object)
-
size
public int size()- Specified by:
size
in interfaceCollection<Integer>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Integer>
-
contains
public boolean contains(int o)Description copied from interface:IntCollection
Returnstrue
if this collection contains the specified element.- Specified by:
contains
in interfaceIntCollection
- See Also:
Collection.contains(Object)
-
iterator
Description copied from interface:IntCollection
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<Integer>
- Specified by:
iterator
in interfaceIntCollection
- Specified by:
iterator
in interfaceIntIterable
- Specified by:
iterator
in interfaceIterable<Integer>
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<Integer>
-
toArray
public <T> T[] toArray(T[] a)- Specified by:
toArray
in interfaceCollection<Integer>
-
toArray
- Specified by:
toArray
in interfaceCollection<Integer>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<Integer>
-
addAll
- Specified by:
addAll
in interfaceCollection<Integer>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<Integer>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<Integer>
-
add
Deprecated.Description copied from interface:IntCollection
- Specified by:
add
in interfaceCollection<Integer>
- Specified by:
add
in interfaceIntCollection
-
contains
Deprecated.Description copied from interface:IntCollection
- Specified by:
contains
in interfaceCollection<Integer>
- Specified by:
contains
in interfaceIntCollection
-
remove
Deprecated.Description copied from interface:IntCollection
- Specified by:
remove
in interfaceCollection<Integer>
- Specified by:
remove
in interfaceIntCollection
-
toIntArray
public int[] toIntArray()Description copied from interface:IntCollection
Returns a primitive type array containing the items of this collection.- Specified by:
toIntArray
in interfaceIntCollection
- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray()
-
toIntArray
Deprecated.Description copied from interface:IntCollection
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:
toIntArray
in interfaceIntCollection
- 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 int[] toArray(int[] a)Description copied from interface:IntCollection
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 interfaceIntCollection
- 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
Description copied from interface:IntCollection
Checks whether this collection contains all elements from the given type-specific collection.- Specified by:
containsAll
in interfaceIntCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection contains all elements of the argument.- See Also:
Collection.containsAll(Collection)
-
addAll
Description copied from interface:IntCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceIntCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.addAll(Collection)
-
removeAll
Description copied from interface:IntCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceIntCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.removeAll(Collection)
-
retainAll
Description copied from interface:IntCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceIntCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
toString
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<Integer>
- Overrides:
hashCode
in classObject
-
equals
- Specified by:
equals
in interfaceCollection<Integer>
- Overrides:
equals
in classObject
-