Imagine Optional and Stream had two additional methods each:
class Optional<T> {
// the usual Optional stuff
// ...
public static <T> Optional<T> pure(T x) {| /* | |
| * Example | |
| * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
| * | |
| * The version of the OpenAPI document: 1.0.0 | |
| * | |
| * | |
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |
| * https://openapi-generator.tech | |
| * Do not edit the class manually. |
| 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) |