item
?Comparisons are done with == Return true if the collection is empty.
assert [1,1,1].has_only(1) == true
assert [1,2,3].has_only(1) == false
assert [1..1].has_only(1) == true
assert [1..3].has_only(1) == false
assert [3..3[.has_only(1) == true
ENSURE is_empty implies result == true
# Is the collection contain only `item`?
# Comparisons are done with ==
# Return true if the collection is empty.
#
# assert [1,1,1].has_only(1) == true
# assert [1,2,3].has_only(1) == false
# assert [1..1].has_only(1) == true
# assert [1..3].has_only(1) == false
# assert [3..3[.has_only(1) == true # empty collection
#
# ENSURE `is_empty implies result == true`
fun has_only(item: nullable Object): Bool
do
for i in self do if i != item then return false
return true
end
lib/core/collection/abstract_collection.nit:101,2--116,4