Instance methods
==(other : SortedMultimap) : Bool
Source[]=(key : K, value : V) : V
Sourcedelete(key : K) : V | Nil
Sourcedup
Returns a shallow copy of this object.
This allocates a new object and copies the contents of
self into it.
Sourceeach
Must yield this collection's elements to the block.
Sourceeach
Must return an Iterator over the elements in this collection.
Sourceempty?
Returns true if self does not contain any element.
([] of Int32).empty? # => true
([1]).empty? # => false
[nil, false].empty? # => false
#present? returns the inverse.
Sourcefetch_at(index : Int, &)
Sourcefetch_at(index : Int, default)
Sourcehas_key?(key : K) : Bool
Sourcehas_value?(value : V) : Bool
Sourceindex(key : K) : Int32 | Nil
Sourceindex_of_largest_leq(key : K) : Int32 | Nil
Sourceindex_of_largest_lt(key : K) : Int32 | Nil
Sourceindex_of_smallest_eq(key : K) : Int32 | Nil
Sourceindex_of_smallest_gt(key : K) : Int32 | Nil
Sourceinspect(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>
Sourcekey_at(index : Int) : K
Returns the key at the index-th.
Sourcekey_at?(index : Int) : K | Nil
Like at, but returns nil
if trying to access an key outside the set's range.
Sourcekey_for?(value) : K | Nil
Sourcelargest_leq(key : K) : Tuple(K, V) | Nil
Sourcelargest_leq_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
Sourcelargest_lt(key : K) : Tuple(K, V) | Nil
Sourcelargest_lt_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
Sourcelower_bound(key : K) : Int32
Sourcemax
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.
Sourcemin
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.
Sourceproper_superset_of?(other : Hash) : Bool
Sourceput(key : K, value : V, &)
Sourcereject
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]
Sourcereject(*keys) : SortedMultimap(K, V)
Sourcereject!(*keys) : SortedMultimap(K, V)
Sourcerindex(key : K) : Int32 | Nil
Sourcerindex!(key : K) : Int32
Sourceselect(*keys) : SortedMultimap(K, V)
Sourceselect!(keys : Indexable) : self
Sourcesize
Returns the number of elements in the collection.
[1, 2, 3, 4].size # => 4
Sourcesmallest_geq(key : K) : Tuple(K, V) | Nil
Sourcesmallest_geq_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
Sourcesmallest_gt(key : K) : Tuple(K, V) | Nil
Sourcesmallest_gt_with_index(key : K) : Tuple(Tuple(K, V) | Nil, Int32 | Nil)
Sourcesubset_of?(other : SortedMultimap(K, V)) : Bool
Sourcesuperset_of?(other : SortedMultimap(K, V)) : Bool
Sourceto_a
Returns an Array with all the elements in the collection.
(1..5).to_a # => [1, 2, 3, 4, 5]
Sourceto_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>
Sourceunordered_each(node = @root, & : Tuple(K, V) -> ) : Nil
Sourceunsafe_fetch(index : Int)
Sourceupdate(key : K, & : V -> V) : V
Sourceupper_bound(key : K) : Int32
Sourcevalue_at(index : Int) : V
Returns the value at the index-th.
Sourcevalue_at?(index : Int) : V | Nil
Like at, but returns nil
if trying to access an value outside the set's range.
Sourcevalues_at(*indices : Int)
Sourcevalues_by_key(*keys : K)
Source