Home
last modified time | relevance | path

Searched refs:empty (Results 1 – 25 of 74) sorted by relevance

123

/libcore/luni/src/test/java/libcore/java/util/
DOptionalTest.java34 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() local
47 empty.get(); in testGet()
58 Optional<String> empty = Optional.empty(); in testIsPresent() local
59 assertFalse(empty.isPresent()); in testIsPresent()
68 Optional<String> empty = Optional.empty(); in testIfPresent() local
74 empty.ifPresent(alwaysFail); in testIfPresent()
85 Optional<String> empty = Optional.empty(); in testFilter() local
[all …]
DOptionalIntTest.java31 assertSame(OptionalInt.empty(), OptionalInt.empty()); in testEmpty_sameInstance()
38 OptionalInt.empty().getAsInt(); in testGet()
46 assertFalse(OptionalInt.empty().isPresent()); in testIsPresent()
51 OptionalInt.empty().ifPresent(alwaysFails); in testIfPresent()
60 assertEquals(57, OptionalInt.empty().orElse(57)); in testOrElse()
69 assertEquals(57, OptionalInt.empty().orElseGet(supplies57)); in testOrElseGet()
79 OptionalInt.empty().orElseThrow(barSupplier); in testOrElseThrow()
87 assertEquals(OptionalInt.empty(), OptionalInt.empty()); in testEquals()
89 assertFalse(OptionalInt.empty().equals(OptionalInt.of(56))); in testEquals()
DOptionalLongTest.java31 assertSame(OptionalLong.empty(), OptionalLong.empty()); in testEmpty_sameInstance()
38 OptionalLong.empty().getAsLong(); in testGet()
46 assertFalse(OptionalLong.empty().isPresent()); in testIsPresent()
51 OptionalLong.empty().ifPresent(alwaysFails); in testIfPresent()
60 assertEquals(57, OptionalLong.empty().orElse(57)); in testOrElse()
69 assertEquals(57, OptionalLong.empty().orElseGet(supplies57)); in testOrElseGet()
79 OptionalLong.empty().orElseThrow(barSupplier); in testOrElseThrow()
87 assertEquals(OptionalLong.empty(), OptionalLong.empty()); in testEquals()
89 assertFalse(OptionalLong.empty().equals(OptionalLong.of(56))); in testEquals()
DOptionalDoubleTest.java33 assertSame(OptionalDouble.empty(), OptionalDouble.empty()); in testEmpty_sameInstance()
40 OptionalDouble.empty().getAsDouble(); in testGet()
48 assertFalse(OptionalDouble.empty().isPresent()); in testIsPresent()
53 OptionalDouble.empty().ifPresent(alwaysFails); in testIfPresent()
62 assertEquals(57.0, OptionalDouble.empty().orElse(57.0)); in testOrElse()
71 assertEquals(57.0, OptionalDouble.empty().orElseGet(supplies57)); in testOrElseGet()
81 OptionalDouble.empty().orElseThrow(barSupplier); in testOrElseThrow()
89 assertEquals(OptionalDouble.empty(), OptionalDouble.empty()); in testEquals()
91 assertFalse(OptionalDouble.empty().equals(OptionalDouble.of(56.0))); in testEquals()
DSpliteratorsTest.java37 Spliterator.OfInt empty = Spliterators.emptyIntSpliterator(); in testEmptyIntSpliterator() local
38 assertNull(empty.trySplit()); in testEmptyIntSpliterator()
39 assertEquals(0, empty.estimateSize()); in testEmptyIntSpliterator()
40 assertEquals(0, empty.getExactSizeIfKnown()); in testEmptyIntSpliterator()
44 empty.tryAdvance(alwaysFails); in testEmptyIntSpliterator()
45 empty.tryAdvance(alwaysFailsBoxed); in testEmptyIntSpliterator()
47 empty.forEachRemaining(alwaysFails); in testEmptyIntSpliterator()
48 empty.forEachRemaining(alwaysFailsBoxed); in testEmptyIntSpliterator()
50 assertEquals(Spliterator.SIZED | Spliterator.SUBSIZED, empty.characteristics()); in testEmptyIntSpliterator()
54 Spliterator<Object> empty = Spliterators.emptySpliterator(); in testEmptyRefSpliterator() local
[all …]
/libcore/ojluni/src/test/java/util/stream/test/org/openjdk/tests/java/util/stream/
DMinMaxTest.java68 assertEquals(IntStream.empty().min(), OptionalInt.empty()); in testIntMinMax()
69 assertEquals(IntStream.empty().max(), OptionalInt.empty()); in testIntMinMax()
81 assertEquals(LongStream.empty().min(), OptionalLong.empty()); in testLongMinMax()
82 assertEquals(LongStream.empty().max(), OptionalLong.empty()); in testLongMinMax()
94 assertEquals(DoubleStream.empty().min(), OptionalDouble.empty()); in testDoubleMinMax()
95 assertEquals(DoubleStream.empty().max(), OptionalDouble.empty()); in testDoubleMinMax()
DConcatTest.java56 List<Integer> empty = new LinkedList<>(); // To be ordered
57 assertTrue(empty.isEmpty()); in empty.isEmpty()
73 { "empty something", empty, part1, part1 },
74 { "something empty", part1, empty, part1 },
75 { "empty empty", empty, empty, empty }
DExplodeOpTest.java79 result = exerciseOps(data, s-> s.flatMap(e -> Stream.empty())); in testOps()
95 result = exerciseOps(data, s -> s.flatMap(i -> IntStream.empty())); in testIntOps()
110 result = exerciseOps(data, s -> LongStream.empty()); in testLongOps()
125 result = exerciseOps(data, s -> DoubleStream.empty()); in testDoubleOps()
/libcore/ojluni/src/main/java/java/util/stream/
DReduceOps.java109 private boolean empty;
113 empty = true;
119 if (empty) {
120 empty = false;
129 return empty ? Optional.empty() : Optional.of(state);
134 if (!other.empty)
291 private boolean empty;
295 empty = true;
301 if (empty) {
302 empty = false;
[all …]
DFindOps.java58 return new FindOp<>(mustFindFirst, StreamShape.REFERENCE, Optional.empty(), in makeRef()
70 return new FindOp<>(mustFindFirst, StreamShape.INT_VALUE, OptionalInt.empty(), in makeInt()
82 return new FindOp<>(mustFindFirst, StreamShape.LONG_VALUE, OptionalLong.empty(), in makeLong()
94 return new FindOp<>(mustFindFirst, StreamShape.DOUBLE_VALUE, OptionalDouble.empty(), in makeDouble()
DIntStream.java701 public static IntStream empty() { in empty() method
796 return empty(); in range()
822 return empty(); in rangeClosed()
DLongStream.java694 public static LongStream empty() { in empty() method
789 return empty(); in range()
822 return empty(); in rangeClosed()
/libcore/ojluni/src/main/java/java/util/
DOptional.java79 public static<T> Optional<T> empty() { in empty() method in Optional
117 return value == null ? empty() : of(value); in ofNullable()
174 return predicate.test(value) ? this : empty(); in filter()
209 return empty(); in map()
235 return empty(); in flatMap()
/libcore/jsr166-tests/src/test/java/jsr166/
DTreeSubMapTest.java126 NavigableMap empty = map0(); in testGet() local
127 assertNull(empty.get(one)); in testGet()
134 NavigableMap empty = map0(); in testIsEmpty() local
136 assertTrue(empty.isEmpty()); in testIsEmpty()
223 NavigableMap empty = map0();
225 empty.putAll(map);
226 assertEquals(5, empty.size());
227 assertTrue(empty.containsKey(one));
228 assertTrue(empty.containsKey(two));
229 assertTrue(empty.containsKey(three));
[all …]
DConcurrentHashMapTest.java295 ConcurrentHashMap empty = new ConcurrentHashMap(); in testGet() local
297 assertNull(empty.get("anything")); in testGet()
304 ConcurrentHashMap empty = new ConcurrentHashMap(); in testIsEmpty() local
306 assertTrue(empty.isEmpty()); in testIsEmpty()
418 ConcurrentHashMap empty = new ConcurrentHashMap(); in testPutAll() local
420 empty.putAll(map); in testPutAll()
421 assertEquals(5, empty.size()); in testPutAll()
422 assertTrue(empty.containsKey(one)); in testPutAll()
423 assertTrue(empty.containsKey(two)); in testPutAll()
424 assertTrue(empty.containsKey(three)); in testPutAll()
[all …]
DConcurrentSkipListSubMapTest.java127 ConcurrentNavigableMap empty = map0(); in testGet() local
128 assertNull(empty.get(one)); in testGet()
135 ConcurrentNavigableMap empty = map0(); in testIsEmpty() local
137 assertTrue(empty.isEmpty()); in testIsEmpty()
266 ConcurrentNavigableMap empty = map0();
268 empty.putAll(map);
269 assertEquals(5, empty.size());
270 assertTrue(empty.containsKey(one));
271 assertTrue(empty.containsKey(two));
272 assertTrue(empty.containsKey(three));
[all …]
DCopyOnWriteArraySetTest.java222 Collection empty = new CopyOnWriteArraySet(); in testIterator() local
223 assertFalse(empty.iterator().hasNext()); in testIterator()
225 empty.iterator().next(); in testIterator()
301 Collection empty = new CopyOnWriteArraySet(); in testSize() local
304 assertEquals(0, empty.size()); in testSize()
331 Collection empty = new CopyOnWriteArraySet(); in testToArray2() local
335 assertSame(a, empty.toArray(a)); in testToArray2()
339 assertSame(a, empty.toArray(a)); in testToArray2()
DCopyOnWriteArrayListTest.java250 CopyOnWriteArrayList empty = new CopyOnWriteArrayList(); in testIsEmpty() local
252 assertTrue(empty.isEmpty()); in testIsEmpty()
261 Collection empty = new CopyOnWriteArrayList(); in testIterator() local
262 assertFalse(empty.iterator().hasNext()); in testIterator()
264 empty.iterator().next(); in testIterator()
421 CopyOnWriteArrayList empty = new CopyOnWriteArrayList(); in testSize() local
424 assertEquals(0, empty.size()); in testSize()
451 Collection empty = new CopyOnWriteArrayList(); in testToArray2() local
455 assertSame(a, empty.toArray(a)); in testToArray2()
459 assertSame(a, empty.toArray(a)); in testToArray2()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/org/xml/sax/helpers/
DAttributeListImplTest.java27 private AttributeListImpl empty = new AttributeListImpl(); field in AttributeListImplTest
39 assertEquals(0, empty.getLength()); in testAttributeListImpl()
45 AttributeListImpl ai = new AttributeListImpl(empty); in testAttributeListImplAttributeList()
67 attrs.setAttributeList(empty); in testSetAttributeList()
134 AttributeListImpl ai = new AttributeListImpl(empty); in testGetLength()
DAttributesImplTest.java26 private AttributesImpl empty = new AttributesImpl(); field in AttributesImplTest
44 assertEquals(0, empty.getLength()); in testAttributesImpl()
50 AttributesImpl ai = new AttributesImpl(empty); in testAttributesImplAttributes()
68 AttributesImpl ai = new AttributesImpl(empty); in testGetLength()
241 attrs.setAttributes(empty); in testSetAttributes()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/
DStackTest.java40 assertTrue("New stack answers non-empty", s.empty()); in test_empty()
42 assertTrue("Stack should not be empty but answers empty", !s.empty()); in test_empty()
44 assertTrue("Stack should be empty but answers non-empty", s.empty()); in test_empty()
47 .empty()); in test_empty()
DWeakHashMapTest.java82 WeakHashMap empty = new WeakHashMap(0); in test_ConstructorI() local
83 assertNull("Empty weakhashmap access", empty.get("nothing")); in test_ConstructorI()
84 empty.put("something", "here"); in test_ConstructorI()
85 assertTrue("cannot get element", empty.get("something") == "here"); in test_ConstructorI()
106 WeakHashMap empty = new WeakHashMap(0, 0.75f); in test_ConstructorIF() local
107 assertNull("Empty hashtable access", empty.get("nothing")); in test_ConstructorIF()
108 empty.put("something", "here"); in test_ConstructorIF()
109 assertTrue("cannot get element", empty.get("something") == "here"); in test_ConstructorIF()
DHashtableTest.java71 Hashtable empty = new Hashtable(0); in test_ConstructorI() local
72 assertNull("Empty hashtable access", empty.get("nothing")); in test_ConstructorI()
73 empty.put("something", "here"); in test_ConstructorI()
74 assertTrue("cannot get element", empty.get("something") == "here"); in test_ConstructorI()
85 Hashtable empty = new Hashtable(0, 0.75f); in test_ConstructorIF() local
86 assertNull("Empty hashtable access", empty.get("nothing")); in test_ConstructorIF()
87 empty.put("something", "here"); in test_ConstructorIF()
88 assertTrue("cannot get element", empty.get("something") == "here"); in test_ConstructorIF()
/libcore/json/src/main/java/org/json/
DJSONStringer.java180 JSONStringer open(Scope empty, String openBracket) throws JSONException { in open() argument
185 stack.add(empty); in open()
195 JSONStringer close(Scope empty, Scope nonempty, String closeBracket) throws JSONException { in close() argument
197 if (context != nonempty && context != empty) { in close()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/org/xml/sax/ext/
DAttributes2ImplTest.java31 private Attributes2Impl empty = new Attributes2Impl(); field in Attributes2ImplTest
69 attrs.setAttributes(empty); in testSetAttributes()
83 attrs.setAttributes(empty); in testSetAttributes()
190 assertEquals(0, empty.getLength()); in testAttributes2Impl()
208 attrs = new Attributes2Impl(empty); in testAttributes2ImplAttributes()

123