Class TUnmodifiableLongCollection
- java.lang.Object
-
- gnu.trove.impl.unmodifiable.TUnmodifiableLongCollection
-
- All Implemented Interfaces:
TLongCollection,java.io.Serializable
- Direct Known Subclasses:
TUnmodifiableLongList,TUnmodifiableLongSet
public class TUnmodifiableLongCollection extends java.lang.Object implements TLongCollection, java.io.Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TUnmodifiableLongCollection(TLongCollection c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(long e)Inserts a value into the collection.booleanaddAll(long[] array)Adds all of the elements in the array to the collection.booleanaddAll(TLongCollection coll)Adds all of the elements in the TLongCollection to the collection.booleanaddAll(java.util.Collection<? extends java.lang.Long> coll)Adds all of the elements in collection to the collection.voidclear()Empties the collection.booleancontains(long o)Returns true if this collection contains the specified element.booleancontainsAll(long[] array)Tests the collection to determine if all of the elements in array are present.booleancontainsAll(TLongCollection coll)Tests the collection to determine if all of the elements in TLongCollection are present.booleancontainsAll(java.util.Collection<?> coll)Tests the collection to determine if all of the elements in collection are present.booleanforEach(TLongProcedure procedure)Executes procedure for each element in the collection.longgetNoEntryValue()Returns the value that is used to represent null.booleanisEmpty()Returns true if this collection contains no elements.TLongIteratoriterator()Creates an iterator over the values of the collection.booleanremove(long o)Removes entry from the collection.booleanremoveAll(long[] array)Removes all of the elements in array from the collection.booleanremoveAll(TLongCollection coll)Removes all of the elements in TLongCollection from the collection.booleanremoveAll(java.util.Collection<?> coll)Removes all of the elements in collection from the collection.booleanretainAll(long[] array)Removes any values in the collection which are not contained in array.booleanretainAll(TLongCollection coll)Removes any values in the collection which are not contained in TLongCollection.booleanretainAll(java.util.Collection<?> coll)Removes any values in the collection which are not contained in collection.intsize()Returns the number of elements in this collection (its cardinality).long[]toArray()Returns an array containing all of the elements in this collection.long[]toArray(long[] a)Returns an array containing elements in this collection.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gnu.trove.TLongCollection
equals, hashCode
-
-
-
-
Constructor Detail
-
TUnmodifiableLongCollection
public TUnmodifiableLongCollection(TLongCollection c)
-
-
Method Detail
-
size
public int size()
Description copied from interface:TLongCollectionReturns the number of elements in this collection (its cardinality). If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.- Specified by:
sizein interfaceTLongCollection- Returns:
- the number of elements in this collection (its cardinality)
-
isEmpty
public boolean isEmpty()
Description copied from interface:TLongCollectionReturns true if this collection contains no elements.- Specified by:
isEmptyin interfaceTLongCollection- Returns:
- true if this collection contains no elements
-
contains
public boolean contains(long o)
Description copied from interface:TLongCollectionReturns true if this collection contains the specified element.- Specified by:
containsin interfaceTLongCollection- Parameters:
o- anlongvalue- Returns:
- true if the collection contains the specified element.
-
toArray
public long[] toArray()
Description copied from interface:TLongCollectionReturns an array containing all of the elements in this collection. If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
- Specified by:
toArrayin interfaceTLongCollection- Returns:
- an array containing all the elements in this collection
-
toArray
public long[] toArray(long[] a)
Description copied from interface:TLongCollectionReturns an array containing elements in this collection.If this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is collection to
TLongCollection.getNoEntryValue(). (This is useful in determining the length of this collection only if the caller knows that this collection does not contain any elements representing null.)If the native array is smaller than the collection size, the array will be filled with elements in Iterator order until it is full and exclude the remainder.
If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
- Specified by:
toArrayin interfaceTLongCollection- Parameters:
a- the array into which the elements of this collection are to be stored.- Returns:
- an long[] containing all the elements in this collection
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getNoEntryValue
public long getNoEntryValue()
Description copied from interface:TLongCollectionReturns the value that is used to represent null. The default value is generally zero, but can be changed during construction of the collection.- Specified by:
getNoEntryValuein interfaceTLongCollection- Returns:
- the value that represents null
-
forEach
public boolean forEach(TLongProcedure procedure)
Description copied from interface:TLongCollectionExecutes procedure for each element in the collection.- Specified by:
forEachin interfaceTLongCollection- Parameters:
procedure- aTLongProcedurevalue- Returns:
- false if the loop over the collection terminated because the procedure returned false for some value.
-
iterator
public TLongIterator iterator()
Description copied from interface:TLongCollectionCreates an iterator over the values of the collection. The iterator supports element deletion.- Specified by:
iteratorin interfaceTLongCollection- Returns:
- an
TLongIteratorvalue
-
add
public boolean add(long e)
Description copied from interface:TLongCollectionInserts a value into the collection.- Specified by:
addin interfaceTLongCollection- Parameters:
e- alongvalue- Returns:
- true if the collection was modified by the add operation
-
remove
public boolean remove(long o)
Description copied from interface:TLongCollectionRemoves entry from the collection.- Specified by:
removein interfaceTLongCollection- Parameters:
o- anlongvalue- Returns:
- true if the collection was modified by the remove operation.
-
containsAll
public boolean containsAll(java.util.Collection<?> coll)
Description copied from interface:TLongCollectionTests the collection to determine if all of the elements in collection are present.- Specified by:
containsAllin interfaceTLongCollection- Parameters:
coll- aCollectionvalue- Returns:
- true if all elements were present in the collection.
-
containsAll
public boolean containsAll(TLongCollection coll)
Description copied from interface:TLongCollectionTests the collection to determine if all of the elements in TLongCollection are present.- Specified by:
containsAllin interfaceTLongCollection- Parameters:
coll- aTLongCollectionvalue- Returns:
- true if all elements were present in the collection.
-
containsAll
public boolean containsAll(long[] array)
Description copied from interface:TLongCollectionTests the collection to determine if all of the elements in array are present.- Specified by:
containsAllin interfaceTLongCollection- Parameters:
array- asarrayof long primitives.- Returns:
- true if all elements were present in the collection.
-
addAll
public boolean addAll(TLongCollection coll)
Description copied from interface:TLongCollectionAdds all of the elements in the TLongCollection to the collection.- Specified by:
addAllin interfaceTLongCollection- Parameters:
coll- aTLongCollectionvalue- Returns:
- true if the collection was modified by the add all operation.
-
addAll
public boolean addAll(java.util.Collection<? extends java.lang.Long> coll)
Description copied from interface:TLongCollectionAdds all of the elements in collection to the collection.- Specified by:
addAllin interfaceTLongCollection- Parameters:
coll- aCollectionvalue- Returns:
- true if the collection was modified by the add all operation.
-
addAll
public boolean addAll(long[] array)
Description copied from interface:TLongCollectionAdds all of the elements in the array to the collection.- Specified by:
addAllin interfaceTLongCollection- Parameters:
array- aarrayof long primitives.- Returns:
- true if the collection was modified by the add all operation.
-
removeAll
public boolean removeAll(java.util.Collection<?> coll)
Description copied from interface:TLongCollectionRemoves all of the elements in collection from the collection.- Specified by:
removeAllin interfaceTLongCollection- Parameters:
coll- aCollectionvalue- Returns:
- true if the collection was modified by the remove all operation.
-
removeAll
public boolean removeAll(TLongCollection coll)
Description copied from interface:TLongCollectionRemoves all of the elements in TLongCollection from the collection.- Specified by:
removeAllin interfaceTLongCollection- Parameters:
coll- aTLongCollectionvalue- Returns:
- true if the collection was modified by the remove all operation.
-
removeAll
public boolean removeAll(long[] array)
Description copied from interface:TLongCollectionRemoves all of the elements in array from the collection.- Specified by:
removeAllin interfaceTLongCollection- Parameters:
array- anarrayof long primitives.- Returns:
- true if the collection was modified by the remove all operation.
-
retainAll
public boolean retainAll(java.util.Collection<?> coll)
Description copied from interface:TLongCollectionRemoves any values in the collection which are not contained in collection.- Specified by:
retainAllin interfaceTLongCollection- Parameters:
coll- aCollectionvalue- Returns:
- true if the collection was modified by the retain all operation
-
retainAll
public boolean retainAll(TLongCollection coll)
Description copied from interface:TLongCollectionRemoves any values in the collection which are not contained in TLongCollection.- Specified by:
retainAllin interfaceTLongCollection- Parameters:
coll- aTLongCollectionvalue- Returns:
- true if the collection was modified by the retain all operation
-
retainAll
public boolean retainAll(long[] array)
Description copied from interface:TLongCollectionRemoves any values in the collection which are not contained in array.- Specified by:
retainAllin interfaceTLongCollection- Parameters:
array- anarrayof long primitives.- Returns:
- true if the collection was modified by the retain all operation
-
clear
public void clear()
Description copied from interface:TLongCollectionEmpties the collection.- Specified by:
clearin interfaceTLongCollection
-
-