Package convex.core.util
Class Trees
java.lang.Object
convex.core.util.Trees
Utility class for tree handling functions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
visitStack
(List<T> stack, Consumer<T> visitor) Visits elements on a stack, popping one off from the end each time.
-
Constructor Details
-
Trees
public Trees()
-
-
Method Details
-
visitStack
Visits elements on a stack, popping one off from the end each time. Visitor function MAY edit the stack. Will terminate when stack is empty. IMPORTANT: O(1) usage of JVM stack, may be necessary to use a function like this when visiting deeply nested trees in CVM code.- Type Parameters:
T
- Type of element to visit- Parameters:
stack
- Stack of values to visit, must be a mutable Listvisitor
- Visitor function to call for each stack element.
-