ArraySet Class

Definition

ArraySet is a generic set data structure that is designed to be more memory efficient than a traditional java.util.HashSet.

[Android.Runtime.Register("android/util/ArraySet", ApiSince=23, DoNotGenerateAcw=true)]
[Java.Interop.JavaTypeParameters(new System.String[] { "E" })]
public sealed class ArraySet : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Util.ISet
[<Android.Runtime.Register("android/util/ArraySet", ApiSince=23, DoNotGenerateAcw=true)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "E" })>]
type ArraySet = class
    inherit Object
    interface ICollection
    interface IIterable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface ISet
Inheritance
ArraySet
Attributes
Implements

Remarks

ArraySet is a generic set data structure that is designed to be more memory efficient than a traditional java.util.HashSet. The design is very similar to ArrayMap, with all of the caveats described there. This implementation is separate from ArrayMap, however, so the Object array contains only one item for each entry in the set (instead of a pair for a mapping).

Note that this implementation is not intended to be appropriate for data structures that may contain large numbers of items. It is generally slower than a traditional HashSet, since lookups require a binary search and adds and removes require inserting and deleting entries in the array. For containers holding up to hundreds of items, the performance difference is not significant, less than 50%.

Because this container is intended to better balance memory use, unlike most other standard Java containers it will shrink its array as items are removed from it. Currently you have no control over this shrinking -- if you set a capacity and then remove an item, it may reduce the capacity to better match the current size. In the future an explicit call to set the capacity should turn off this aggressive shrinking behavior.

This structure is <b>NOT</b> thread-safe.

Java documentation for android.util.ArraySet.

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

ArraySet()

Create a new empty ArraySet.

ArraySet(ArraySet)

Create a new ArraySet with the mappings from the given ArraySet.

ArraySet(ICollection)

Create a new ArraySet with items from the given collection.

ArraySet(Int32)

Create a new ArraySet with a given initial capacity.

ArraySet(Object[])

Create a new ArraySet with items from the given array

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsEmpty

Return true if the array map contains no items.

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.

(Inherited from Object)
ThresholdType

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

(Inherited from Object)

Methods

Add(Object)

Adds the specified object to this set.

AddAll(ArraySet)

Perform a #add(Object) of all values in <var>array</var>

AddAll(ICollection)

Perform an #add(Object) of all values in <var>collection</var>

Clear()

Make the array map empty.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Contains(Object)

Check whether a value exists in the set.

ContainsAll(ICollection)

Determine if the array set contains all of the values in the given collection.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EnsureCapacity(Int32)

Ensure the array map can hold at least <var>minimumCapacity</var> items.

Equals(Object)

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

(Inherited from Object)
ForEach(IConsumer)

Performs the given action for all elements in the stored order.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IndexOf(Object)

Returns the index of a value in the set.

Iterator()

Return an java.util.Iterator over all values in the set.

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)
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)
Remove(Object)

Removes the specified object from this set.

RemoveAll(ArraySet)

Perform a #remove(Object) of all values in <var>array</var>

RemoveAll(ICollection)

Remove all values in the array set that exist in the given collection.

RemoveAt(Int32)

Remove the key/value mapping at the given index.

RemoveIf(IPredicate)

Removes all values that satisfy the predicate.

RetainAll(ICollection)

Remove all values in the array set that do <b>not</b> exist in the given collection.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Size()

Return the number of items in this array map.

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

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
ValueAt(Int32)

Return the value at the given index in the array.

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, 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)
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)

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)
ToEnumerable(IIterable)
ToEnumerable<T>(IIterable)

Applies to