core :: ArrayMapValues :: defaultinit
core $ ArrayMapValues :: SELF
Type of this instance, automatically specialized in every classcore $ ArrayMapValues :: remove
Remove an occurrence ofitem
core $ ArrayMapValues :: remove_all
Remove all occurrences ofitem
core :: Collection :: CONCURRENT
Type of the concurrent variant of this collectioncore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Collection :: combinations
Allr
-length combinations on self (in same order) without repeated elements.
core :: Collection :: combinations_with_replacement
Allr
-length combination on self (in same order) with repeated elements.
core :: ArrayMapValues :: defaultinit
core :: Collection :: defaultinit
core :: Object :: defaultinit
core :: Collection :: has_all
Does the collection contain at least each element ofother
?
core :: Collection :: has_any
Does the collection contain at least one element ofother
?
core :: Collection :: has_exactly
Does the collection contain exactly all the elements ofother
?
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).core :: Collection :: permutations
Allr
-length permutations on self (all possible ordering) without repeated elements.
core :: Collection :: product
Cartesian product, overr
times self
.
core :: RemovableCollection :: remove
Remove an occurrence ofitem
core :: RemovableCollection :: remove_all
Remove all occurrences ofitem
core :: Collection :: serialize_to_pure_json
Utility to serialize a normal Json arraycore :: Collection :: to_concurrent
Wrapsself
in a thread-safe collection
core :: Collection :: to_counter
Create and fill up a counter with the elements of `self.core :: Collection :: to_curlslist
Convert Collection[String] to CURLSListcore :: Collection :: to_shuffle
Return a new array made of elements in a random order.
private class ArrayMapValues[K, E]
super RemovableCollection[E]
# The original map
var map: ArrayMap[K, E]
redef fun first do return self.map._items.first.second
redef fun is_empty do return self.map.is_empty
redef fun length do return self.map.length
redef fun iterator do return new MapValuesIterator[K, E](self.map.iterator)
# O(n)
redef fun has(item)
do
for i in self.map._items do if i.second == item then return true
return false
end
# O(n)
redef fun has_only(item)
do
for i in self.map._items do if i.second != item then return false
return true
end
# O(n)
redef fun count(item)
do
var nb = 0
for i in self.map._items do if i.second == item then nb += 1
return nb
end
redef fun clear do self.map.clear
redef fun remove(item)
do
var map = self.map
var i = map._items.length - 1
while i >= 0 do
if map._items[i].second == item then
map.remove_at_index(i)
return
end
i -= 1
end
end
redef fun remove_all(item)
do
var map = self.map
var i = map._items.length - 1
while i >= 0 do
if map._items[i].second == item then
map.remove_at_index(i)
end
i -= 1
end
end
end
lib/core/collection/array.nit:822,1--879,3