frost.collections

Interface MapView<K, V>

A read-only view of the standard "Map" abstract data type, which stores key/value pairs such that no key appears more than once in the collection. Given a key, a MapView will return the corresponding value, and generally does so very quickly (constant or log n time, depending on the implementation).

Source Code:
View Source

Field Summary

count:Int
The number of key/value pairs the map contains.
keys:Iterator<K>
An iterator which returns all of the keys in the map.
values:Iterator<V>
An iterator which returns all of the values in the map.
entries:Iterator<(frost.collections.MapView.K, frost.collections.MapView.V)>
An iterator which returns all of the (key, value) pairs in the map.
Inherited Fields:

Instance Method Summary

-- index operator --
[](key:K):V?
Returns the value mapped to the given key, or null if no such mapping exists.
contains(key:K):Bit
Returns true if the map contains the given key (even if the value it maps to is null)

Fields

property count:Int

The number of key/value pairs the map contains.

property keys:Iterator<K>

An iterator which returns all of the keys in the map.

property values:Iterator<V>

An iterator which returns all of the values in the map. Because multiple keys may map to the same value, this iterator may return duplicate values.

An iterator which returns all of the (key, value) pairs in the map.

Instance Methods

-- index operator --
function [] (key:K
):V?

Returns the value mapped to the given key, or null if no such mapping exists. If the map's type permits null values, this function does not distinguish between cases where the map does not contain the given key, and cases where it does contain the key, but it maps to null. The contains method can be used to disambiguate this situation.

Parameters:
key - value of type K
function contains (key:K
):Bit

Returns true if the map contains the given key (even if the value it maps to is null)

Parameters:
key - value of type K