Imagine Optional and Stream had two additional methods each:
class Optional<T> {
// the usual Optional stuff
// ...
public static <T> Optional<T> pure(T x) {
benchmarking cheating | |
time 243.8 μs (243.2 μs .. 244.4 μs) | |
1.000 R² (1.000 R² .. 1.000 R²) | |
mean 244.4 μs (244.2 μs .. 244.7 μs) | |
std dev 1.055 μs (852.6 ns .. 1.361 μs) | |
benchmarking boxed vector | |
time 689.7 μs (685.5 μs .. 693.4 μs) | |
1.000 R² (0.999 R² .. 1.000 R²) | |
mean 685.0 μs (681.0 μs .. 689.6 μs) |