次の方法で共有


EnumMap Class

Definition

A specialized Map implementation for use with enum type keys.

[Android.Runtime.Register("java/util/EnumMap", DoNotGenerateAcw=true)]
[Java.Interop.JavaTypeParameters(new System.String[] { "K extends java.lang.Enum<K>", "V" })]
public class EnumMap : Java.Util.AbstractMap, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable, Java.Lang.ICloneable
[<Android.Runtime.Register("java/util/EnumMap", DoNotGenerateAcw=true)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "K extends java.lang.Enum<K>", "V" })>]
type EnumMap = class
    inherit AbstractMap
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface ICloneable
    interface IMap
Inheritance
Attributes
Implements

Remarks

A specialized Map implementation for use with enum type keys. All of the keys in an enum map must come from a single enum type that is specified, explicitly or implicitly, when the map is created. Enum maps are represented internally as arrays. This representation is extremely compact and efficient.

Enum maps are maintained in the natural order of their keys (the order in which the enum constants are declared). This is reflected in the iterators returned by the collections views (#keySet(), #entrySet(), and #values()).

Iterators returned by the collection views are weakly consistent: they will never throw ConcurrentModificationException and they may or may not show the effects of any modifications to the map that occur while the iteration is in progress.

Null keys are not permitted. Attempts to insert a null key will throw NullPointerException. Attempts to test for the presence of a null key or to remove one will, however, function properly. Null values are permitted.

Like most collection implementations EnumMap is not synchronized. If multiple threads access an enum map concurrently, and at least one of the threads modifies the map, it should be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the enum map. If no such object exists, the map should be "wrapped" using the Collections#synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access:

Map&lt;EnumKey, V&gt; m
                    = Collections.synchronizedMap(new EnumMap&lt;EnumKey, V&gt;(...));

Implementation note: All basic operations execute in constant time. They are likely (though not guaranteed) to be faster than their HashMap counterparts.

This class is a member of the Java Collections Framework.

Added in 1.5.

Java documentation for java.util.EnumMap.

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

EnumMap(Class)

Creates an empty enum map with the specified key type.

EnumMap(EnumMap)

Creates an enum map with the same key type as the specified enum map, initially containing the same mappings (if any).

EnumMap(IDictionary)

Creates an enum map initialized from the specified map.

EnumMap(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)
IsEmpty

To be added

(Inherited from AbstractMap)
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

Clear()

To be added

(Inherited from AbstractMap)
Clone()

Returns a shallow copy of this enum map.

ContainsKey(Object)

To be added

(Inherited from AbstractMap)
ContainsValue(Object)

To be added

(Inherited from AbstractMap)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EntrySet()

Returns a Set view of the mappings contained in this map.

Equals(Object)

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

(Inherited from Object)
Get(Object)

To be added

(Inherited from AbstractMap)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
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)
KeySet()

To be added

(Inherited from AbstractMap)
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)
Put(Object, Object)

To be added

(Inherited from AbstractMap)
PutAll(IDictionary)

To be added

(Inherited from AbstractMap)
Remove(Object)

To be added

(Inherited from AbstractMap)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Size()

To be added

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

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Values()

To be added

(Inherited from AbstractMap)
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)

Applies to