InternMap<K, V> Class
The InternMap<K, V> class provides the canonical value object corresponding to the specified key.
public sealed class InternMap<K, V>
where K : notnull
where V : class
Type Parameters
- K
-
notnull
The type of the key.
- V
-
class
The type of the value.
- Inheritance
-
Intern
Map<K, V>
Constructors
Intern |
Initializes a new instance of the InternMap<K, V> class. |
Intern |
Initializes a new instance of the InternMap<K, V> class. |
Intern |
Initializes a new instance of the InternMap<K, V> class. |
Methods
Intern(K) |
Gets the canonical value object corresponding to the specified key object. If the canonical value object does not exist in the internal object pool, creates a new value object with the function specified with the constructor. |
Equals(object) | (Inherited from object) |
GetHashCode() | (Inherited from object) |
GetType() | (Inherited from object) |
MemberwiseClone() | (Inherited from object) |
ToString() | (Inherited from object) |
Constructors Detail
InternMap(Func<K, V>)
Initializes a new instance of the InternMap<K, V> class.
public InternMap(Func<K, V> newValue)
Parameters
- newValue
- Func<K, V>
The function that returns a new value object corresponding to the specified argument.
InternMap(Func<K, V>, int)
Initializes a new instance of the InternMap<K, V> class.
public InternMap(Func<K, V> newValue, int initialCapacity)
Parameters
- newValue
- Func<K, V>
The function that returns a new value object corresponding to the specified argument.
- initialCapacity
- int
The initial capacity.
InternMap(Func<K, V>, int, int)
Initializes a new instance of the InternMap<K, V> class.
public InternMap(Func<K, V> newValue, int initialCapacity, int concurrencyLevel)
Parameters
- newValue
- Func<K, V>
The function that returns a new value object corresponding to the specified argument.
- initialCapacity
- int
The initial capacity.
- concurrencyLevel
- int
The concurrency level.
Methods Detail
Intern(K)
Gets the canonical value object corresponding to the specified key object. If the canonical value object does not exist in the internal object pool, creates a new value object with the function specified with the constructor.
public V Intern(K key)
Parameters
- key
- K
The key object.
Returns
The canonical value object.
Remarks
The function newValue
specified with the constructor can be
called concurrently with the equal keys if the multiple threads call
this method. Even so, this method returns only one canonical object
corresponding to the specified key.