Package io.substrait.relation
Class CopyOnWriteUtils
java.lang.Object
io.substrait.relation.CopyOnWriteUtils
Provides common utilities for copy-on-write visitations
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCopyOnWriteUtils.TransformFunction<T,C extends VisitationContext, E extends Exception> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic <T> Optional<T>The `or` method on Optional instances is a Java 9+ featurestatic <I,C extends VisitationContext, E extends Exception>
Optional<List<I>>transformList(List<I> items, C context, CopyOnWriteUtils.TransformFunction<I, C, E> transform) Applies the given transformation function to each item in the list.
-
Constructor Details
-
CopyOnWriteUtils
public CopyOnWriteUtils()
-
-
Method Details
-
allEmpty
-
or
The `or` method on Optional instances is a Java 9+ feature -
transformList
public static <I,C extends VisitationContext, Optional<List<I>> transformListE extends Exception> (List<I> items, C context, CopyOnWriteUtils.TransformFunction<I, C, throws EE> transform) Applies the given transformation function to each item in the list. If any of the list items are transformed, returns a new list in which each item is either- a transformed new item replacing an old item
- the original item in the position it was in
- Parameters:
items- the list of items to transformtransform- the transformation function to apply to each item- Returns:
- An empty optional if none of the items have changed. An optional containing a new list otherwise.
- Throws:
E extends Exception
-