class

Immutable::Map::Trie(K, V)

Inherits Enumerable < Reference < Object

Constants

BITMAP_MASK = ((2_u64 ** BLOCK_SIZE) - 1_u64)
BITS_PER_LEVEL = 5_u64
BLOCK_SIZE = 2_u64 ** BITS_PER_LEVEL
INDEX_MASK = BLOCK_SIZE - 1_u64

Constructors

new(children : Array(Trie(K, V)), values : Values(K, V), bitmap : UInt64, levels : Int32, owner : UInt64 | Nil = nil)
Source

Class methods

empty(owner : UInt64 | Nil = nil)
Source

Instance methods

clear_owner!
Source
delete(key : K) : Trie(K, V)
Source
delete!(key : K, from : UInt64) : Trie(K, V)
Source
each

Must yield this collection's elements to the block.

Source
each
Source
empty?

Returns true if self does not contain any element.

([] of Int32).empty? # => true
([1]).empty?         # => false
[nil, false].empty?  # => false
  • #present? returns the inverse.
Source
fetch(key : K, &block : K -> _)
Source
find_entry(key : K) : Entry(K, V) | Nil
Source
get(key : K) : V
Source
has_key?(key : K) : Bool
Source
levels
Source
set(key : K, value : V) : Trie(K, V)
Source
set!(key : K, value : V, from : UInt64) : Trie(K, V)
Source
size

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4
Source

Nested types