interface CanIndex<K, V>
Interface CanIndex<K,V>
specifies that a class can return a value associated with a particular key. This interface allows overloading of the []
operator used to load values. If this operator is applied, the appropriate index(K)
method will be called, returning a matching value or throwing an exception if the key cannot be found. This interface provides load indexing functionality for arrays and symbol tables. It differs from the CanIndexNullable<K,V>
interface in that its index(K)
method will never return null
. Interface CanIndexStore<K,V>
provides related index store functionality.
Modifiers | Return Types | Method and Description |
---|---|---|
public readonly |
(V) |
index(K key) Method called to retrieve the value associated with the key. |
public readonly index(K key) => (V)
Method called to retrieve the value associated with the key.
key
- key to look up
value associated with the key