class NgLib:: SqrtMap(K, V)

Included Modules

Defined in:

nglib/data_structure/sortedcontainers/sqrt_map.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self. new (hash : Hash(K, V)) #

[ View source ]
def self. new (default_value : V) #

[ View source ]
def self. new (█ : self , K -> V) #

[ View source ]
def self. new (block : self , K -> V | Nil = nil ) #

[ View source ]

Class Method Detail

def self. zip (keys : Array(K), values : Array(V)) #

[ View source ]

Instance Method Detail

def [] (key : K) : V #

[ View source ]
def []= (key : K, value : V) : V #

[ View source ]
def []? (key : K) : V | Nil #

[ View source ]
def at (index : Int ) : Tuple(K, V) #

[ View source ]
def at (index : Int , &) #

Returns the key-value at the index -th.


[ View source ]
def at? (index : Int ) : Tuple(K, V) | Nil #

Like #at , but returns nil if trying to access an key-value outside the set's range.


[ View source ]
def delete (key : K) : V | Nil #

[ View source ]
def each (&) : Nil #
Description copied from module Enumerable({K, V})

Must yield this collection's elements to the block.


[ View source ]
def each : Iterator(Tuple(K, V)) #
Description copied from module Iterable({K, V})

Must return an Iterator over the elements in this collection.


[ View source ]
def fetch (key : K, &) #

[ View source ]
def fetch (key : K, default_value) #

[ View source ]
def fetch_at (index : Int , &) #

[ View source ]
def fetch_at (index : Int , default_value) #

[ View source ]
def has_key? (key : K) : Bool #

[ View source ]
def invert : SqrtMap (V, K) #

[ View source ]
def key_at (index : Int ) : K #

Returns the key at the index -th.


[ View source ]
def key_at? (index : Int ) : K | Nil #

Like #at , but returns nil if trying to access an key outside the set's range.


[ View source ]
def key_for (value) : K #

[ View source ]
def key_for (value, &) #

[ View source ]
def key_for? (value) : K | Nil #

[ View source ]
def keys : Array(K) #

[ View source ]
def put (key : K, value : V, &) #

[ View source ]
def size (*args, **options) #

[ View source ]
def size (*args, **options, &) #

[ View source ]
def unsafe_fetch (index : Int ) : Tuple(K, V) #

[ View source ]
def update (key : K, & : V -> V) : V #

[ View source ]
def value_at (index : Int ) : V #

Returns the value at the index -th.


[ View source ]
def value_at? (index : Int ) : V | Nil #

Like #at , but returns nil if trying to access an value outside the set's range.


[ View source ]
def values : Array(V) #

[ View source ]
def values_at (*indices : Int ) #

[ View source ]
def values_by_key (*keys : K) #

[ View source ]