Collections Class

Definition

This class consists exclusively of static methods that operate on or return collections.

[Android.Runtime.Register("java/util/Collections", DoNotGenerateAcw=true)]
public class Collections : Java.Lang.Object
[<Android.Runtime.Register("java/util/Collections", DoNotGenerateAcw=true)>]
type Collections = class
    inherit Object
Inheritance
Collections
Attributes

Remarks

This class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, "wrappers", which return a new collection backed by a specified collection, and a few other odds and ends.

The methods of this class all throw a NullPointerException if the collections or class objects provided to them are null.

The documentation for the polymorphic algorithms contained in this class generally includes a brief description of the implementation. Such descriptions should be regarded as implementation notes, rather than parts of the specification. Implementors should feel free to substitute other algorithms, so long as the specification itself is adhered to. (For example, the algorithm used by sort does not have to be a mergesort, but it does have to be stable.)

The "destructive" algorithms contained in this class, that is, the algorithms that modify the collection on which they operate, are specified to throw UnsupportedOperationException if the collection does not support the appropriate mutation primitive(s), such as the set method. These algorithms may, but are not required to, throw this exception if an invocation would have no effect on the collection. For example, invoking the sort method on an unmodifiable list that is already sorted may or may not throw UnsupportedOperationException.

This class is a member of the Java Collections Framework.

Added in 1.2.

Java documentation for java.util.Collections.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Collections(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AddAll(ICollection, Object[])

Adds all of the specified elements to the specified collection.

AsLifoQueue(IDeque)

Returns a view of a Deque as a Last-in-first-out (Lifo) Queue.

BinarySearch(IList, Object)

Searches the specified list for the specified object using the binary search algorithm.

BinarySearch(IList, Object, IComparator)

Searches the specified list for the specified object using the binary search algorithm.

CheckedCollection(ICollection, Class)

Returns a dynamically typesafe view of the specified collection.

CheckedList(IList, Class)

Returns a dynamically typesafe view of the specified list.

CheckedMap(IDictionary, Class, Class)

Returns a dynamically typesafe view of the specified map.

CheckedNavigableMap(INavigableMap, Class, Class)

Returns a dynamically typesafe view of the specified navigable map.

CheckedNavigableSet(INavigableSet, Class)

Returns a dynamically typesafe view of the specified navigable set.

CheckedQueue(IQueue, Class)

Returns a dynamically typesafe view of the specified queue.

CheckedSet(ICollection, Class)

Returns a dynamically typesafe view of the specified set.

CheckedSortedMap(IDictionary, Class, Class)

Returns a dynamically typesafe view of the specified sorted map.

CheckedSortedSet(ISortedSet, Class)

Returns a dynamically typesafe view of the specified sorted set.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Copy(IList, IList)

Copies all of the elements from one list into another.

Disjoint(ICollection<Object>, ICollection<Object>)

Returns true if the two specified collections have no elements in common.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EmptyEnumeration()

Returns an enumeration that has no elements.

EmptyIterator()

Returns an iterator that has no elements.

EmptyList()

Returns an empty list (immutable).

EmptyListIterator()

Returns a list iterator that has no elements.

EmptyMap()

Returns an empty map (immutable).

EmptyNavigableMap()

Returns an empty navigable map (immutable).

EmptyNavigableSet()

Returns an empty navigable set (immutable).

EmptySet()

Returns an empty set (immutable).

EmptySortedMap()

Returns an empty sorted map (immutable).

EmptySortedSet()

Returns an empty sorted set (immutable).

Enumeration(ICollection)

Returns an enumeration over the specified collection.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Fill(IList, Object)

Replaces all of the elements of the specified list with the specified element.

Frequency(ICollection<Object>, Object)

Returns the number of elements in the specified collection equal to the specified object.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IndexOfSubList(IList<Object>, IList<Object>)

Returns the starting position of the first occurrence of the specified target list within the specified source list, or -1 if there is no such occurrence.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
LastIndexOfSubList(IList<Object>, IList<Object>)

Returns the starting position of the last occurrence of the specified target list within the specified source list, or -1 if there is no such occurrence.

List(IEnumeration)

Returns an array list containing the elements returned by the specified enumeration in the order they are returned by the enumeration.

Max(ICollection)

Returns the maximum element of the given collection, according to the natural ordering of its elements.

Max(ICollection, IComparator)

Returns the maximum element of the given collection, according to the order induced by the specified comparator.

Min(ICollection)

Returns the minimum element of the given collection, according to the natural ordering of its elements.

Min(ICollection, IComparator)

Returns the minimum element of the given collection, according to the order induced by the specified comparator.

NCopies(Int32, Object)

Returns an immutable list consisting of n copies of the specified object.

NewSetFromMap(IDictionary)

Returns a set backed by the specified map.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ReplaceAll(IList, Object, Object)

Replaces all occurrences of one specified value in a list with another.

Reverse(IList<Object>)

Reverses the order of the elements in the specified list.

ReverseOrder()

Returns a comparator that imposes the reverse of the <em>natural ordering</em> on a collection of objects that implement the Comparable interface.

ReverseOrder(IComparator)

Returns a comparator that imposes the reverse ordering of the specified comparator.

Rotate(IList<Object>, Int32)

Rotates the elements in the specified list by the specified distance.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Shuffle(IList<Object>)

Randomly permutes the specified list using a default source of randomness.

Shuffle(IList<Object>, Random)

Randomly permute the specified list using the specified source of randomness.

Singleton(Object)

Returns an immutable set containing only the specified object.

SingletonList(Object)

Returns an immutable list containing only the specified object.

SingletonMap(Object, Object)

Returns an immutable map, mapping only the specified key to the specified value.

Sort(IList)

Sorts the specified list into ascending order, according to the Comparable natural ordering of its elements.

Sort(IList, IComparator)

Sorts the specified list according to the order induced by the specified comparator.

Swap(IList<Object>, Int32, Int32)

Swaps the elements at the specified positions in the specified list.

SynchronizedCollection(ICollection)

Returns a synchronized (thread-safe) collection backed by the specified collection.

SynchronizedList(IList)

Returns a synchronized (thread-safe) list backed by the specified list.

SynchronizedMap(IDictionary)

Returns a synchronized (thread-safe) map backed by the specified map.

SynchronizedNavigableMap(INavigableMap)

Returns a synchronized (thread-safe) navigable map backed by the specified navigable map.

SynchronizedNavigableSet(INavigableSet)

Returns a synchronized (thread-safe) navigable set backed by the specified navigable set.

SynchronizedSet(ICollection)

Returns a synchronized (thread-safe) set backed by the specified set.

SynchronizedSortedMap(IDictionary)

Returns a synchronized (thread-safe) sorted map backed by the specified sorted map.

SynchronizedSortedSet(ISortedSet)

Returns a synchronized (thread-safe) sorted set backed by the specified sorted set.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnmodifiableCollection(ICollection)

Returns an unmodifiable view of the specified collection.

UnmodifiableList(IList)

Returns an unmodifiable view of the specified list.

UnmodifiableMap(IDictionary)

Returns an unmodifiable view of the specified map.

UnmodifiableNavigableMap(INavigableMap)

Returns an unmodifiable view of the specified navigable map.

UnmodifiableNavigableSet(INavigableSet)

Returns an unmodifiable view of the specified navigable set.

UnmodifiableSet(ICollection)

Returns an unmodifiable view of the specified set.

UnmodifiableSortedMap(IDictionary)

Returns an unmodifiable view of the specified sorted map.

UnmodifiableSortedSet(ISortedSet)

Returns an unmodifiable view of the specified sorted set.

UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to