Home
last modified time | relevance | path

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

123456

/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()
69 Optional<String> empty = Optional.empty(); in testIfPresent() local
75 empty.ifPresent(alwaysFail); in testIfPresent()
86 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.java41 Spliterator.OfInt empty = Spliterators.emptyIntSpliterator(); in testEmptyIntSpliterator() local
42 assertNull(empty.trySplit()); in testEmptyIntSpliterator()
43 assertEquals(0, empty.estimateSize()); in testEmptyIntSpliterator()
44 assertEquals(0, empty.getExactSizeIfKnown()); in testEmptyIntSpliterator()
48 empty.tryAdvance(alwaysFails); in testEmptyIntSpliterator()
49 empty.tryAdvance(alwaysFailsBoxed); in testEmptyIntSpliterator()
51 empty.forEachRemaining(alwaysFails); in testEmptyIntSpliterator()
52 empty.forEachRemaining(alwaysFailsBoxed); in testEmptyIntSpliterator()
54 assertEquals(Spliterator.SIZED | Spliterator.SUBSIZED, empty.characteristics()); in testEmptyIntSpliterator()
58 Spliterator<Object> empty = Spliterators.emptySpliterator(); in testEmptyRefSpliterator() local
[all …]
/libcore/ojluni/src/test/java/util/Optional/
DBasicInt.java55 void checkEmpty(OptionalInt empty) { in checkEmpty() argument
56 assertTrue(empty.equals(OptionalInt.empty())); in checkEmpty()
57 assertTrue(OptionalInt.empty().equals(empty)); in checkEmpty()
58 assertFalse(empty.equals(OptionalInt.of(UNEXPECTED))); in checkEmpty()
59 assertFalse(OptionalInt.of(UNEXPECTED).equals(empty)); in checkEmpty()
60 assertFalse(empty.equals("unexpected")); in checkEmpty()
62 assertFalse(empty.isPresent()); in checkEmpty()
65 assertTrue(OptionalInt_isEmpty(empty)); in checkEmpty()
66 assertEquals(empty.hashCode(), 0); in checkEmpty()
67 assertEquals(empty.orElse(UNEXPECTED), UNEXPECTED); in checkEmpty()
[all …]
DBasicLong.java54 void checkEmpty(OptionalLong empty) { in checkEmpty() argument
55 assertTrue(empty.equals(OptionalLong.empty())); in checkEmpty()
56 assertTrue(OptionalLong.empty().equals(empty)); in checkEmpty()
57 assertFalse(empty.equals(OptionalLong.of(UNEXPECTED))); in checkEmpty()
58 assertFalse(OptionalLong.of(UNEXPECTED).equals(empty)); in checkEmpty()
59 assertFalse(empty.equals("unexpected")); in checkEmpty()
61 assertFalse(empty.isPresent()); in checkEmpty()
64 assertTrue(OptionalLong_isEmpty(empty)); in checkEmpty()
65 assertEquals(empty.hashCode(), 0); in checkEmpty()
66 assertEquals(empty.orElse(UNEXPECTED), UNEXPECTED); in checkEmpty()
[all …]
DBasicDouble.java54 void checkEmpty(OptionalDouble empty) { in checkEmpty() argument
55 assertTrue(empty.equals(OptionalDouble.empty())); in checkEmpty()
56 assertTrue(OptionalDouble.empty().equals(empty)); in checkEmpty()
57 assertFalse(empty.equals(OptionalDouble.of(UNEXPECTED))); in checkEmpty()
58 assertFalse(OptionalDouble.of(UNEXPECTED).equals(empty)); in checkEmpty()
59 assertFalse(empty.equals("unexpected")); in checkEmpty()
61 assertFalse(empty.isPresent()); in checkEmpty()
64 assertTrue(OptionalDouble_isEmpty(empty)); in checkEmpty()
65 assertEquals(empty.hashCode(), 0); in checkEmpty()
66 assertEquals(empty.orElse(UNEXPECTED), UNEXPECTED); in checkEmpty()
[all …]
DBasic.java58 void checkEmpty(Optional<String> empty) { in checkEmpty() argument
59 assertTrue(empty.equals(Optional.empty())); in checkEmpty()
60 assertTrue(Optional.empty().equals(empty)); in checkEmpty()
61 assertFalse(empty.equals(Optional.of("unexpected"))); in checkEmpty()
62 assertFalse(Optional.of("unexpected").equals(empty)); in checkEmpty()
63 assertFalse(empty.equals("unexpected")); in checkEmpty()
65 assertFalse(empty.isPresent()); in checkEmpty()
68 assertTrue(Optional_isEmpty(empty)); in checkEmpty()
69 assertEquals(empty.hashCode(), 0); in checkEmpty()
70 assertEquals(empty.orElse("x"), "x"); in checkEmpty()
[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 }
/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 …]
/libcore/ojluni/src/test/java/lang/invoke/MethodHandles/
DTestTableSwitch.java217 MethodHandle empty = MethodHandles.empty(MethodType.methodType(void.class)); in testNotEnoughParameters() local
218 MethodHandles.tableSwitch(empty, empty, empty); in testNotEnoughParameters()
224 MethodHandle empty = MethodHandles.empty(MethodType.methodType(void.class, double.class)); in testNoLeadingIntParameter() local
225 MethodHandles.tableSwitch(empty, empty, empty); in testNoLeadingIntParameter()
232 MethodHandle wrongType = MethodHandles.empty(MethodType.methodType(void.class, int.class)); in testWrongCaseType()
/libcore/ojluni/src/main/java/java/util/
DOptional.java87 public static<T> Optional<T> empty() { in empty() method in Optional
219 return predicate.test(value) ? this : empty(); in filter()
259 return empty(); in map()
287 return empty(); in flatMap()
336 return Stream.empty(); in stream()
/libcore/ojluni/src/test/java/util/concurrent/tck/
DTreeSubMapTest.java149 NavigableMap empty = map0(); in testGet() local
150 assertNull(empty.get(one)); in testGet()
157 NavigableMap empty = map0(); in testIsEmpty() local
159 assertTrue(empty.isEmpty()); in testIsEmpty()
246 NavigableMap empty = map0();
248 empty.putAll(map);
249 assertEquals(5, empty.size());
250 assertTrue(empty.containsKey(one));
251 assertTrue(empty.containsKey(two));
252 assertTrue(empty.containsKey(three));
[all …]
DConcurrentHashMapTest.java320 ConcurrentHashMap empty = new ConcurrentHashMap(); in testGet() local
322 assertNull(empty.get("anything")); in testGet()
329 ConcurrentHashMap empty = new ConcurrentHashMap(); in testIsEmpty() local
331 assertTrue(empty.isEmpty()); in testIsEmpty()
458 ConcurrentHashMap empty = new ConcurrentHashMap(); in testPutAll() local
460 empty.putAll(map); in testPutAll()
461 assertEquals(5, empty.size()); in testPutAll()
462 assertTrue(empty.containsKey(one)); in testPutAll()
463 assertTrue(empty.containsKey(two)); in testPutAll()
464 assertTrue(empty.containsKey(three)); in testPutAll()
[all …]
DConcurrentSkipListSubMapTest.java150 ConcurrentNavigableMap empty = map0(); in testGet() local
151 assertNull(empty.get(one)); in testGet()
158 ConcurrentNavigableMap empty = map0(); in testIsEmpty() local
160 assertTrue(empty.isEmpty()); in testIsEmpty()
289 ConcurrentNavigableMap empty = map0();
291 empty.putAll(map);
292 assertEquals(5, empty.size());
293 assertTrue(empty.containsKey(one));
294 assertTrue(empty.containsKey(two));
295 assertTrue(empty.containsKey(three));
[all …]
DCopyOnWriteArraySetTest.java244 Collection empty = new CopyOnWriteArraySet(); in testIterator() local
245 assertFalse(empty.iterator().hasNext()); in testIterator()
247 empty.iterator().next(); in testIterator()
323 Collection empty = new CopyOnWriteArraySet(); in testSize() local
326 assertEquals(0, empty.size()); in testSize()
353 Collection empty = new CopyOnWriteArraySet(); in testToArray2() local
357 assertSame(a, empty.toArray(a)); in testToArray2()
361 assertSame(a, empty.toArray(a)); in testToArray2()
/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()
/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()
/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()
/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()

123456