core :: SequenceRead :: last
Is equivalent with self[length-1].
self[length-1]
var a = [1,2,3] assert a.last == 3
REQUIRE not is_empty
not is_empty
# Get the last item. # Is equivalent with `self[length-1]`. # # var a = [1,2,3] # assert a.last == 3 # # REQUIRE `not is_empty` fun last: E do assert not_empty: not is_empty return self[length-1] end
redef fun last do mutex.lock var r = real_collection.last mutex.unlock return r end
# O(1) redef fun last do return _tail.as(not null).item