class

AVLTree::SortedMultimap(K, V)

Inherits Iterable < Enumerable < Reference < Object

Constructors

new(hash : Hash(K, V))
Source
new(defalut_value : V)
Source

Class methods

zip(ary1 : Array(K), ary2 : Array(V))
Source

Instance methods

==(other : SortedMultimap) : Bool
Source
[](key : K) : V
Source
[]=(key : K, value : V) : V
Source
[]?(key : K) : V | Nil
Source
at(index : Int)
Source
at(index : Int, &)
Source
at?(index : Int)
Source
clear
Source
clone
Source
compact
Source
compact!
Source
delete(key : K) : V | Nil
Source
delete(key : K, &)
Source
delete_at(index : Int)
Source
delete_at?(index : Int)
Source
dig(key : K)
Source
dig(key : K, *subkeys)
Source
dig?(key : K)
Source
dig?(key : K, *subkeys)
Source
dup

Returns a shallow copy of this object.

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

Source
each

Must yield this collection's elements to the block.

Source
each

Must return an Iterator over the elements in this collection.

Source
each_key
Source
each_key
Source
each_value
Source
each_value
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, default)
Source
fetch(key : K, &)
Source
fetch_at(index : Int, &)
Source
fetch_at(index : Int, default)
Source
first_key
Source
first_key?
Source
first_value
Source
first_value?
Source
has_key?(key : K) : Bool
Source
has_value?(value : V) : Bool
Source
index(key : K) : Int32 | Nil
Source
index!(key : K) : Int32
Source
index_of_largest_leq(key : K) : Int32 | Nil
Source
index_of_largest_lt(key : K) : Int32 | Nil
Source
index_of_smallest_eq(key : K) : Int32 | Nil
Source
index_of_smallest_gt(key : K) : Int32 | Nil
Source
inspect(io : IO) : Nil

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>
Source
invert
Source
key_at(index : Int) : K

Returns the key at the index-th.

Source
key_at?(index : Int) : K | Nil

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

Source
key_for(value) : K
Source
key_for(value, &)
Source
key_for?(value) : K | Nil
Source
keys
Source
largest_leq(key : K) : Tuple(K, V) | Nil
Source
largest_leq_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
Source
largest_lt(key : K) : Tuple(K, V) | Nil
Source
largest_lt_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
Source
last_key
Source
last_key?
Source
last_value
Source
last_value?
Source
lower_bound(key : K) : Int32
Source
max

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.

Source
min

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.

Source
pop?
Source
proper_superset_of?(other : Hash) : Bool
Source
put(key : K, value : V, &)
Source
reject

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]
Source
reject(*keys) : SortedMultimap(K, V)
Source
reject!
Source
reject!(keys : Enumerable) : SortedMultimap(K, V)
Source
reject!(*keys) : SortedMultimap(K, V)
Source
reverse_each
Source
reverse_each
Source
reverse_each_key
Source
reverse_each_key
Source
reverse_each_value
Source
reverse_each_value
Source
rindex(key : K) : Int32 | Nil
Source
rindex!(key : K) : Int32
Source
select(keys : Enumerable) : SortedMultimap(K, V)
Source
select(*keys) : SortedMultimap(K, V)
Source
select!(keys : Indexable) : self
Source
select!(keys : Enumerable) : self
Source
select!(*keys) : self
Source
shift
Source
shift
Source
shift?
Source
size

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4
Source
smallest_geq(key : K) : Tuple(K, V) | Nil
Source
smallest_geq_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
Source
smallest_gt(key : K) : Tuple(K, V) | Nil
Source
smallest_gt_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
Source
subset_of?(other : SortedMultimap(K, V)) : Bool
Source
superset_of?(other : SortedMultimap(K, V)) : Bool
Source
to_a

Returns an Array with all the elements in the collection.

(1..5).to_a # => [1, 2, 3, 4, 5]
Source
to_hash
Source
to_s(io : IO) : Nil

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>
Source
unordered_each(node = @root, & : Tuple(K, V) -> ) : Nil
Source
unsafe_fetch(index : Int)
Source
update(key : K, & : V -> V) : V
Source
upper_bound(key : K) : Int32
Source
value_at(index : Int) : V

Returns the value at the index-th.

Source
value_at?(index : Int) : V | Nil

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

Source
values
Source
values_at(*indices : Int)
Source
values_by_key(*keys : K)
Source