class CB::Types::TreeNode(T)
- CB::Types::TreeNode(T)
- Reference
- Object
Included Modules
- Enumerable({CB::Types::TreeNode(T), Int32})
Defined in:
types/tree.crConstructors
Instance Method Summary
- #<<(node : TreeNode(T))
- #<<(arr : Array)
- #<<(value : T)
- #children : Array(TreeNode(T))
- #children=(children : Array(TreeNode(T)))
-
#each(&block : Tuple(TreeNode(T), Int32) -> )
Must yield this collection's elements to the block.
- #each_value(&block : T -> )
-
#find(&block : T -> Bool)
Returns the first element in the collection for which the passed block is truthy.
- #has_children?
- #last_child?
- #parent : TreeNode(T) | Nil
- #parent=(parent : TreeNode(T) | Nil)
- #value : T
- #value=(value : T)
Constructor Detail
Instance Method Detail
Description copied from module Enumerable({CB::Types::TreeNode(T), Int32})
Must yield this collection's elements to the block.
def find(&block : T -> Bool)
#
Description copied from module Enumerable({CB::Types::TreeNode(T), Int32})
Returns the first element in the collection for which the passed block is truthy.
Accepts an optional parameter if_none, to set what gets returned if
no element is found (defaults to nil
).
[1, 2, 3, 4].find { |i| i > 2 } # => 3
[1, 2, 3, 4].find { |i| i > 8 } # => nil
[1, 2, 3, 4].find(-1) { |i| i > 8 } # => -1