Package org.apache.tapestry5.func
Interface FlowOperations<T,FT>
- 
- Type Parameters:
- T- the type of data in the flow
- FT- the type of flow (either- Flow<T>or- ZippedFlow<Tuple<T, ?>)
 - All Superinterfaces:
- java.lang.Iterable<T>
 - All Known Subinterfaces:
- Flow<T>,- ZippedFlow<A,B>
 
 public interface FlowOperations<T,FT> extends java.lang.Iterable<T> - Since:
- 5.3
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description FTconcat(java.util.Collection<? extends T> collection)Returns a new Flow with the elements in the collection appended to this Flow.intcount()Returns the number of values in this flow.FTdrop(int length)Returns a new flow with the first elements omitted.FTeach(Worker<? super T> worker)Applies the worker to each element in the Flow, then returns the flow for further behaviors.FTfilter(Predicate<? super T> predicate)Filters values, keeping only values where the predicate is true, returning a new Flow with just the retained values.Tfirst()Returns the first element in the Flow.booleanisEmpty()Returns true if the Flow contains no values.<A> Areduce(Reducer<A,T> reducer, A initial)Applies a Reducer to the values of the Flow.FTremove(Predicate<? super T> predicate)Removes values where the predicate returns true, returning a new Flow with just the remaining values.FTremoveNulls()Removes null elements from the flow (null tuples from a ZippedFlow), leaving just the non-null elements.FTrest()Returns a new Flow containing all but the first element in this flow.FTreverse()Returns a new flow with the same elements but in reverse order.FTsort(java.util.Comparator<T> comparator)Sorts this flow using the comparator, forming a new flow.FTtake(int length)Returns a new flow containing just the first elements from this Flow.java.util.List<T>toList()Converts the Flow into an unmodifiable list of values.java.util.Set<T>toSet()Converts the Flow into an unmodifiable set of values.
 
- 
- 
- 
Method Detail- 
filterFT filter(Predicate<? super T> predicate) Filters values, keeping only values where the predicate is true, returning a new Flow with just the retained values.
 - 
removeFT remove(Predicate<? super T> predicate) Removes values where the predicate returns true, returning a new Flow with just the remaining values.
 - 
eachFT each(Worker<? super T> worker) Applies the worker to each element in the Flow, then returns the flow for further behaviors. Each is a non-lazy operation; it will fully realize the values of the Flow.
 - 
toListjava.util.List<T> toList() Converts the Flow into an unmodifiable list of values. This is a non-lazy operation that will fully realize the values of the Flow.
 - 
toSetjava.util.Set<T> toSet() Converts the Flow into an unmodifiable set of values. This is a non-lazy operation that will fully realize the values of the Flow.
 - 
isEmptyboolean isEmpty() Returns true if the Flow contains no values. This may realize the first value in the Flow.
 - 
firstT first() Returns the first element in the Flow. Returns null for empty flows, but remember that null is a valid element within a flow, so useisEmpty()to determine if a flow is actually empty. The first element can be realized without realizing the full Flow.
 - 
restFT rest() Returns a new Flow containing all but the first element in this flow. If this flow has only a single element, or is empty, this will return an empty Flow.
 - 
countint count() Returns the number of values in this flow. This forces the realization of much of the flow (i.e., because each value will need to be passed through anyPredicates).
 - 
sortFT sort(java.util.Comparator<T> comparator) Sorts this flow using the comparator, forming a new flow. This is a non-lazy operation; it will fully realize the elements of the Flow.
 - 
takeFT take(int length) Returns a new flow containing just the first elements from this Flow.- Parameters:
- length- maximum number of values in the Flow
 
 - 
dropFT drop(int length) Returns a new flow with the first elements omitted.- Parameters:
- length- number of values to drop
 
 - 
concatFT concat(java.util.Collection<? extends T> collection) Returns a new Flow with the elements in the collection appended to this Flow. This is a lazy operation. Note that the type of this method changed fromListtoCollectionin Tapestry 5.4. This is considered a compatible change.- Parameters:
- collection- collection of elements to be appended
 
 - 
reduce<A> A reduce(Reducer<A,T> reducer, A initial) Applies a Reducer to the values of the Flow. The Reducer is passed the initial value and the first element from the Flow. The result is captured as the accumulator and passed to the Reducer with the next value from the Flow, and so on. The final accumulator value is returned. If the flow is empty, the initial value is returned. Reducing is a non-lazy operation; it will fully realize the values of the Flow.
 - 
removeNullsFT removeNulls() Removes null elements from the flow (null tuples from a ZippedFlow), leaving just the non-null elements. This is a lazy operation.- Since:
- 5.3
 
 
- 
 
-