class AVLTree::SortedMultimap(K, V)
- AVLTree::SortedMultimap(K, V)
- Reference
- Object
Included Modules
- Enumerable({K, V})
- Iterable({K, V})
Defined in:
avltree/sorted_multimap.crConstructors
Class Method Summary
Instance Method Summary
- #==(other : SortedMultimap) : Bool
- #[](key : K) : V
- #[]=(key : K, value : V) : V
- #[]?(key : K) : V | Nil
- #at(index : Int)
- #at(index : Int, &)
- #at?(index : Int)
- #clear : self
- #clone
- #compact
- #compact! : self
- #delete(key : K) : V | Nil
- #delete(key : K, &)
- #delete_at(index : Int)
- #delete_at?(index : Int)
- #dig(key : K)
- #dig(key : K, *subkeys)
- #dig?(key : K)
- #dig?(key : K, *subkeys)
-
#dup
Returns a shallow copy of this object.
-
#each(& : Tuple(K, V) -> ) : Nil
Must yield this collection's elements to the block.
-
#each
Must return an
Iteratorover the elements in this collection. - #each_key(& : K -> ) : Nil
- #each_key
- #each_value(& : V -> ) : Nil
- #each_value
-
#empty?
Returns
trueifselfis empty,falseotherwise. - #fetch(key : K, default)
- #fetch(key : K, &)
- #fetch_at(index : Int, &)
- #fetch_at(index : Int, default)
- #first_key : K
- #first_key? : K | Nil
- #first_value : K
- #first_value? : K | Nil
- #greater_equal_index(key : K) : Int32 | Nil
- #greater_equal_item(key : K) : Tuple(K, V) | Nil
- #greater_equal_item_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
- #greater_index(key : K) : Int32 | Nil
- #greater_item(key : K) : Tuple(K, V) | Nil
- #greater_item_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
- #has_key?(key : K) : Bool
- #has_value?(value : V) : Bool
- #index(key : K) : Int32 | Nil
- #index!(key : K) : Int32
-
#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.
- #invert : SortedMultimap(V, K)
- #key_at(index : Int) : K
- #key_at?(index : Int) : K
- #key_for(value) : K
- #key_for(value, &)
- #key_for?(value) : K | Nil
- #keys : Array(K)
- #last_key : K
- #last_key? : K | Nil
- #last_value : K
- #last_value? : K | Nil
- #less_equal_index(key : K) : Int32 | Nil
- #less_equal_item(key : K) : Tuple(K, V) | Nil
- #less_equal_item_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
- #less_index(key : K) : Int32 | Nil
- #less_item(key : K) : Tuple(K, V) | Nil
- #less_item_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
- #lower_bound(key : K) : Int32
-
#max
Returns the element with the maximum value in the collection.
-
#min
Returns the element with the minimum value in the collection.
- #pop : Tuple(K, V)
- #pop(&)
- #pop? : Tuple(K, V) | Nil
- #proper_superset_of?(other : Hash) : Bool
- #put(key : K, value : V, &)
-
#reject(& : K, V -> ) : SortedMultimap(K, V)
Returns an
Arraywith all the elements in the collection for which the passed block is falsey. - #reject(*keys) : SortedMultimap(K, V)
- #reject!(& : K, V -> ) : SortedMultimap(K, V)
- #reject!(keys : Enumerable) : SortedMultimap(K, V)
- #reject!(*keys) : SortedMultimap(K, V)
- #reverse_each(& : Tuple(K, V) -> ) : Nil
- #reverse_each
- #reverse_each_key(& : K -> ) : Nil
- #reverse_each_key
- #reverse_each_value(& : V -> ) : Nil
- #reverse_each_value
- #rindex(key : K) : Int32 | Nil
- #rindex!(key : K) : Int32
- #select(keys : Enumerable) : SortedMultimap(K, V)
- #select(*keys) : SortedMultimap(K, V)
- #select!(keys : Indexable) : self
- #select!(keys : Enumerable) : self
- #select!(*keys) : self
- #shift : Tuple(K, V)
- #shift(&)
- #shift? : Tuple(K, V) | Nil
-
#size : Int32
Returns the number of elements in the collection.
- #subset_of?(other : SortedMultimap(K, V)) : Bool
- #superset_of?(other : SortedMultimap(K, V)) : Bool
-
#to_a : Array(Tuple(K, V))
Returns an
Arraywith all the elements in the collection. - #to_hash
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
- #unordered_each(node = @root, & : Tuple(K, V) -> ) : Nil
- #unsafe_fetch(index : Int)
- #update(key : K, & : V -> V) : V
- #upper_bound(key : K) : Int32
- #value_at(index : Int) : K
- #value_at?(index : Int) : K
- #values : Array(V)
- #values_at(*indices : Int)
- #values_by_key(*keys : K)
Instance methods inherited from module Enumerable({K, V})
to_sorted_multiset
to_sorted_multiset,
to_sorted_set
to_sorted_set
Constructor Detail
Class Method Detail
Instance Method Detail
Returns a shallow copy of this object.
This allocates a new object and copies the contents of
self into it.
Must yield this collection's elements to the block.
Must return an Iterator over the elements in this collection.
Returns true if self is empty, false otherwise.
([] of Int32).empty? # => true
([1]).empty? # => false
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>
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.
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.
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]
Returns the number of elements in the collection.
[1, 2, 3, 4].size # => 4
Returns an Array with all the elements in the collection.
(1..5).to_a # => [1, 2, 3, 4, 5]
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>