Home
last modified time | relevance | path

Searched refs:Optional (Results 1 – 16 of 16) sorted by relevance

/libcore/luni/src/test/java/libcore/java/util/
DOptionalTest.java23 import java.util.Optional;
34 assertSame(Optional.<Integer>empty(), Optional.<String>empty()); in testEmpty_sameInstance()
35 assertSame(Optional.<String>empty(), Optional.<String>empty()); in testEmpty_sameInstance()
40 assertSame(Optional.<String>empty(), Optional.ofNullable(null)); in testEmpty_sameInstance()
44 Optional<String> empty = Optional.empty(); in testGet()
53 Optional<String> optionalFoo = Optional.of(foo); in testGet()
58 Optional<String> empty = Optional.empty(); in testIsPresent()
61 Optional<String> optionalFoo = Optional.of("foo"); in testIsPresent()
64 assertFalse(Optional.<String>ofNullable(null).isPresent()); in testIsPresent()
68 Optional<String> empty = Optional.empty(); in testIfPresent()
[all …]
DOptionalDoubleTest.java23 import java.util.Optional;
/libcore/ojluni/src/main/java/java/util/
DOptional.java46 public final class Optional<T> { class
50 private static final Optional<?> EMPTY = new Optional<>();
63 private Optional() { in Optional() method in Optional
79 public static<T> Optional<T> empty() { in empty()
81 Optional<T> t = (Optional<T>) EMPTY; in empty()
91 private Optional(T value) { in Optional() method in Optional
103 public static <T> Optional<T> of(T value) { in of()
104 return new Optional<>(value); in of()
116 public static <T> Optional<T> ofNullable(T value) { in ofNullable()
169 public Optional<T> filter(Predicate<? super T> predicate) { in filter()
[all …]
/libcore/ojluni/src/main/java/java/util/stream/
DFindOps.java27 import java.util.Optional;
57 public static <T> TerminalOp<T, Optional<T>> makeRef(boolean mustFindFirst) { in makeRef()
58 return new FindOp<>(mustFindFirst, StreamShape.REFERENCE, Optional.empty(), in makeRef()
59 Optional::isPresent, FindSink.OfRef::new); in makeRef()
190 static final class OfRef<T> extends FindSink<T, Optional<T>> {
192 public Optional<T> get() { in get()
193 return hasValue ? Optional.of(value) : null; in get()
DStream.java35 import java.util.Optional;
647 Optional<T> reduce(BinaryOperator<T> accumulator); in reduce()
823 Optional<T> min(Comparator<? super T> comparator); in min()
840 Optional<T> max(Comparator<? super T> comparator); in max()
935 Optional<T> findFirst(); in findFirst()
955 Optional<T> findAny(); in findAny()
DReduceOps.java28 import java.util.Optional;
104 public static <T> TerminalOp<T, Optional<T>>
108 implements AccumulatingSink<T, Optional<T>, ReducingSink> {
128 public Optional<T> get() {
129 return empty ? Optional.empty() : Optional.of(state);
138 return new ReduceOp<T, Optional<T>, ReducingSink>(StreamShape.REFERENCE) {
DReferencePipeline.java30 import java.util.Optional;
481 public final Optional<P_OUT> findFirst() {
486 public final Optional<P_OUT> findAny() {
496 public final Optional<P_OUT> reduce(BinaryOperator<P_OUT> accumulator) {
532 public final Optional<P_OUT> max(Comparator<? super P_OUT> comparator) {
537 public final Optional<P_OUT> min(Comparator<? super P_OUT> comparator) {
DCollectors.java44 import java.util.Optional;
430 public static <T> Collector<T, ?, Optional<T>>
449 public static <T> Collector<T, ?, Optional<T>>
697 public static <T> Collector<T, ?, Optional<T>>
715 return new CollectorImpl<T, OptionalBox, Optional<T>>(
718 a -> Optional.ofNullable(a.value), CH_NOID);
/libcore/ojluni/src/test/java/util/stream/test/org/openjdk/tests/java/util/stream/
DReduceTest.java33 import java.util.Optional;
64 Optional<Integer> seedless = exerciseTerminalOps(data, s -> s.reduce(rPlus)); in testOps()
DFindAnyOpTest.java75Optional<Integer> or = withData(data).terminal(fs, s -> s.findAny()).equalator(VALID_ANSWER).exerc… in exerciseStream()
162 …static final BiConsumer<Optional<Integer>, Optional<Integer>> VALID_ANSWER = (a, b) -> assertEqual…
DDistinctOpTest.java37 import java.util.Optional;
72Optional<Integer> oi = Stream.iterate(1, i -> i + 1).unordered().parallel().distinct().findAny(); in testWithUnorderedInfiniteStream()
DSortedOpTest.java154 assertEquals(knownSize.apply(1).findFirst(), Optional.of(1)); in testSequentialShortCircuitTerminal()
155 assertEquals(knownSize.apply(1).findAny(), Optional.of(1)); in testSequentialShortCircuitTerminal()
156 assertEquals(unknownSize.apply(1).findFirst(), Optional.of(1)); in testSequentialShortCircuitTerminal()
157 assertEquals(unknownSize.apply(1).findAny(), Optional.of(1)); in testSequentialShortCircuitTerminal()
DRangeTest.java30 import java.util.Optional;
54 terminal(s->s.findFirst()).expectedResult(Optional.of(10001)).exercise(); in testInfiniteRangeFindFirst()
DFindFirstOpTest.java68 Optional<Integer> r = exerciseTerminalOps(data, fs, s -> s.findFirst()); in exerciseStream()
DTabulatorsTest.java37 import java.util.Optional;
222 Optional<U> reduced = source.get().map(mapper).reduce(reducer); in assertValue()
/libcore/
Dopenjdk_java_files.bp912 "ojluni/src/main/java/java/util/Optional.java",