core :: Collection :: first
assert [1,2,3].first == 1
# Return the first item of the collection # # assert [1,2,3].first == 1 fun first: E do assert length > 0 return iterator.item end
# Get the first item. # Is equivalent with `self[0]`. # # var a = [1,2,3] # assert a.first == 1 # # REQUIRE `not is_empty` redef fun first do assert not_empty: not is_empty return self[0] end
redef var first
redef fun first do mutex.lock var r = real_collection.first mutex.unlock return r end
redef fun first do return item
redef fun first do return self.map._items.first.first
redef fun first do return self.map._items.first.second
redef fun first do return self.map._first_item._key
redef fun first do return self.map._first_item._value
# var tree = new OrderedTree[Int] # tree.add(null, 1) # tree.add(1, 11) # assert tree.first == 1 redef fun first do return roots.first
# `first` is made an alias of `peek` to avoid bad surprises redef fun first do return peek
redef fun first do assert _array.length > 0 return _array.first end
# O(1) redef fun first do return _head.as(not null).item
redef fun first: Int do assert _length > 0 return _values[0] end
redef fun first do assert _the_length > 0 return _first_item._key end