Note that self
and keys
are views on the same data;
therefore any modification of one is visible on the other.
var x = new HashMap[String, Int]
x["four"] = 4
assert x.keys.has("four") == true
assert x.keys.has("five") == false
# Return the point of view of self on the keys only.
# Note that `self` and `keys` are views on the same data;
# therefore any modification of one is visible on the other.
#
# var x = new HashMap[String, Int]
# x["four"] = 4
# assert x.keys.has("four") == true
# assert x.keys.has("five") == false
fun keys: Collection[K] is abstract
lib/core/collection/abstract_collection.nit:595,2--603,36
redef fun keys: RemovableCollection[K] is abstract
lib/core/collection/abstract_collection.nit:765,2--51
redef var keys: RemovableCollection[K] = new HashMapKeys[K, V](self) is lazy
lib/core/collection/hash_collection.nit:279,2--77
redef var keys: RemovableCollection[K] = new ArrayMapKeys[K, E](self) is lazy
lib/core/collection/array.nit:716,2--78