Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Due to historical reasons, tapestry-func duplicates a lot of functionality that is now provided by the JDK itself.
For example:
- org.apache.tapestry5.func.LazyValue<T> is a java.util.function.Supplier<T>
- org.apache.tapestry5.func.Worker<T> is a java.util.function.Consumer<T>
- org.apache.tapestry5.func.Predicate<T> is a java.util.function.Predicate<T>
I propose the following changes:
- The existing types should extend their JDK equivalent, with the single-abstract method of the JDK variant calling the original one.
This way, no existing code will break, but all the convenience methods from the JDK type are available. - tapestry-func types should be marked as deprecated
- Types using the tapestry-func types should accept the JDK variants instead
- Mark the types as @FunctionalInterface
However, replacing org.apache.tapestry5.func.Flow<T> with java.util.stream.Stream<T> seems like overkill to me.
It would need to be benchmark, but my educated guess is that the overhead of Streams wouldn't justify a replacement.