Tree.Branch<T>, Tree.Leaf<T>
Modifier and Type | Method and Description |
---|---|
Tree.Branch<T> |
asBranch()
Returns this instance as a Branch if it's a branch,
or null if it's a leaf.
|
Tree.Leaf<T> |
asLeaf()
Returns this instance as a Leaf if it's a leaf,
or null if it's a branch.
|
T |
getItem()
Returns the item referenced by this leaf.
|
boolean |
isLeaf()
Returns true if this instance is a Leaf, false if it's a Branch.
|
<R> Tree.Leaf<R> |
map(java.util.function.Function<T,R> mapping)
Recursively converts this Tree to one with the same structure,
but with the leaf items mapped from their existing values to
new values determined by a supplied mapping function.
|
public Leaf(T item)
item
- item held by this leafpublic T getItem()
public boolean isLeaf()
Tree
public Tree.Leaf<T> asLeaf()
Tree
public Tree.Branch<T> asBranch()
Tree
public <R> Tree.Leaf<R> map(java.util.function.Function<T,R> mapping)
Tree
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.