class GLib::List(T)
- GLib::List(T)
- Reference
- Object
Included Modules
- Enumerable(T)
Defined in:
lib/gi-crystal/src/bindings/g_lib/list.crConstructors
Instance Method Summary
- #[](n : Int32) : T
- #[]?(n : Int32) : T?
-
#each(&block : T -> _)
Must yield this collection's elements to the block.
- #finalize
-
#first : T
Returns the first element in the collection.
-
#first? : T?
Returns the first element in the collection.
- #last : T
- #last? : T?
-
#size
Returns the number of elements in the collection.
- #to_unsafe
Constructor Detail
Instance Method Detail
def each(&block : T -> _)
#
Description copied from module Enumerable(T)
Must yield this collection's elements to the block.
def first : T
#
Description copied from module Enumerable(T)
Returns the first element in the collection. Raises Enumerable::EmptyError
if the collection is empty.
([1, 2, 3]).first # => 1
([] of Int32).first # raises Enumerable::EmptyError
def first? : T?
#
Description copied from module Enumerable(T)
Returns the first element in the collection.
When the collection is empty, returns nil
.
([1, 2, 3]).first? # => 1
([] of Int32).first? # => nil
def size
#
Description copied from module Enumerable(T)
Returns the number of elements in the collection.
[1, 2, 3, 4].size # => 4