InternMap<K, V> Class

The InternMap<K, V> class provides the canonical value object corresponding to the specified key.

C#
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
InternMap<K, V>

Constructors

InternMap(Func<K, V>)

Initializes a new instance of the InternMap<K, V> class.

InternMap(Func<K, V>, int)

Initializes a new instance of the InternMap<K, V> class.

InternMap(Func<K, V>, int, int)

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.

C#
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.

C#
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.

C#
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.

C#
public V Intern(K key)

Parameters

key
K

The key object.

Returns

V

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.