class AVLTree::SortedMultimap(K, V)

Included Modules

Defined in:

avltree/sorted_multimap.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Enumerable({K, V})

to_sorted_multiset to_sorted_multiset, to_sorted_set to_sorted_set

Constructor Detail

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

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

[View source]
def self.new #

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

[View source]

Class Method Detail

def self.zip(ary1 : Array(K), ary2 : Array(V)) #

[View source]

Instance Method Detail

def ==(other : SortedMultimap) : Bool #

[View source]
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) #

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

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

[View source]
def clear : self #

[View source]
def clone #

[View source]
def compact #

[View source]
def compact! : self #

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

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

[View source]
def delete_at(index : Int) #

[View source]
def delete_at?(index : Int) #

[View source]
def dig(key : K) #

[View source]
def dig(key : K, *subkeys) #

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

[View source]
def dig?(key : K, *subkeys) #

[View source]
def dup #
Description copied from class Reference

Returns a shallow copy of this object.

This allocates a new object and copies the contents of self into it.


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

Must yield this collection's elements to the block.


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

Must return an Iterator over the elements in this collection.


[View source]
def each_key(& : K -> ) : Nil #

[View source]
def each_key #

[View source]
def each_value(& : V -> ) : Nil #

[View source]
def each_value #

[View source]
def empty? #
Description copied from module Enumerable({K, V})

Returns true if self is empty, false otherwise.

([] of Int32).empty? # => true
([1]).empty?         # => false

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

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

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

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

[View source]
def first_key : K #

[View source]
def first_key? : K | Nil #

[View source]
def first_value : K #

[View source]
def first_value? : K | Nil #

[View source]
def greater_equal_index(key : K) : Int32 | Nil #

[View source]
def greater_equal_item(key : K) : Tuple(K, V) | Nil #

[View source]
def greater_equal_item_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil) #

[View source]
def greater_index(key : K) : Int32 | Nil #

[View source]
def greater_item(key : K) : Tuple(K, V) | Nil #

[View source]
def greater_item_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil) #

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

[View source]
def has_value?(value : V) : Bool #

[View source]
def index(key : K) : Int32 | Nil #

[View source]
def index!(key : K) : Int32 #

[View source]
def inspect(io : IO) : Nil #
Description copied from class Reference

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

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

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

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

[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 last_key : K #

[View source]
def last_key? : K | Nil #

[View source]
def last_value : K #

[View source]
def last_value? : K | Nil #

[View source]
def less_equal_index(key : K) : Int32 | Nil #

[View source]
def less_equal_item(key : K) : Tuple(K, V) | Nil #

[View source]
def less_equal_item_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil) #

[View source]
def less_index(key : K) : Int32 | Nil #

[View source]
def less_item(key : K) : Tuple(K, V) | Nil #

[View source]
def less_item_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil) #

[View source]
def lower_bound(key : K) : Int32 #

[View source]
def max #
Description copied from module Enumerable({K, V})

Returns the element with the maximum value in the collection.

It compares using > so it will work for any type that supports that method.

[1, 2, 3].max        # => 3
["Alice", "Bob"].max # => "Bob"

Raises Enumerable::EmptyError if the collection is empty.


[View source]
def min #
Description copied from module Enumerable({K, V})

Returns the element with the minimum value in the collection.

It compares using < so it will work for any type that supports that method.

[1, 2, 3].min        # => 1
["Alice", "Bob"].min # => "Alice"

Raises Enumerable::EmptyError if the collection is empty.


[View source]
def pop : Tuple(K, V) #

[View source]
def pop(&) #

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

[View source]
def proper_superset_of?(other : Hash) : Bool #

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

[View source]
def reject(& : K, V -> ) : SortedMultimap(K, V) #
Description copied from module Enumerable({K, V})

Returns an Array with all the elements in the collection for which the passed block is falsey.

[1, 2, 3, 4, 5, 6].reject { |i| i % 2 == 0 } # => [1, 3, 5]

[View source]
def reject(*keys) : SortedMultimap(K, V) #

[View source]
def reject!(& : K, V -> ) : SortedMultimap(K, V) #

[View source]
def reject!(keys : Enumerable) : SortedMultimap(K, V) #

[View source]
def reject!(*keys) : SortedMultimap(K, V) #

[View source]
def reverse_each(& : Tuple(K, V) -> ) : Nil #

[View source]
def reverse_each #

[View source]
def reverse_each_key(& : K -> ) : Nil #

[View source]
def reverse_each_key #

[View source]
def reverse_each_value(& : V -> ) : Nil #

[View source]
def reverse_each_value #

[View source]
def rindex(key : K) : Int32 | Nil #

[View source]
def rindex!(key : K) : Int32 #

[View source]
def select(keys : Enumerable) : SortedMultimap(K, V) #

[View source]
def select(*keys) : SortedMultimap(K, V) #

[View source]
def select!(keys : Indexable) : self #

[View source]
def select!(keys : Enumerable) : self #

[View source]
def select!(*keys) : self #

[View source]
def shift : Tuple(K, V) #

[View source]
def shift(&) #

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

[View source]
def size : Int32 #
Description copied from module Enumerable({K, V})

Returns the number of elements in the collection.

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

[View source]
def subset_of?(other : SortedMultimap(K, V)) : Bool #

[View source]
def superset_of?(other : SortedMultimap(K, V)) : Bool #

[View source]
def to_a : Array(Tuple(K, V)) #
Description copied from module Enumerable({K, V})

Returns an Array with all the elements in the collection.

(1..5).to_a # => [1, 2, 3, 4, 5]

[View source]
def to_hash #

[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]
def unordered_each(node = @root, & : Tuple(K, V) -> ) : Nil #

[View source]
def unsafe_fetch(index : Int) #

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

[View source]
def upper_bound(key : K) : Int32 #

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

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

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

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

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

[View source]