19 |
|
import java.util.List; |
20 |
|
import java.util.NoSuchElementException; |
21 |
|
import java.util.Queue; |
22 |
+ |
import java.util.Set; |
23 |
|
import java.util.Spliterator; |
24 |
|
import java.util.concurrent.BlockingDeque; |
25 |
|
import java.util.concurrent.BlockingQueue; |
60 |
|
|
61 |
|
Object bomb() { |
62 |
|
return new Object() { |
63 |
< |
public boolean equals(Object x) { throw new AssertionError(); } |
64 |
< |
public int hashCode() { throw new AssertionError(); } |
63 |
> |
@Override public boolean equals(Object x) { throw new AssertionError(); } |
64 |
> |
@Override public int hashCode() { throw new AssertionError(); } |
65 |
> |
@Override public String toString() { throw new AssertionError(); } |
66 |
|
}; |
67 |
|
} |
68 |
|
|
94 |
|
assertTrue(c.isEmpty()); |
95 |
|
assertEquals(0, c.size()); |
96 |
|
assertEquals("[]", c.toString()); |
97 |
+ |
if (c instanceof List<?>) { |
98 |
+ |
List x = (List) c; |
99 |
+ |
assertEquals(1, x.hashCode()); |
100 |
+ |
assertEquals(x, Collections.emptyList()); |
101 |
+ |
assertEquals(Collections.emptyList(), x); |
102 |
+ |
assertEquals(-1, x.indexOf(impl.makeElement(86))); |
103 |
+ |
assertEquals(-1, x.lastIndexOf(impl.makeElement(99))); |
104 |
+ |
} |
105 |
+ |
else if (c instanceof Set<?>) { |
106 |
+ |
assertEquals(0, c.hashCode()); |
107 |
+ |
assertEquals(c, Collections.emptySet()); |
108 |
+ |
assertEquals(Collections.emptySet(), c); |
109 |
+ |
} |
110 |
|
{ |
111 |
|
Object[] a = c.toArray(); |
112 |
|
assertEquals(0, a.length); |
267 |
|
() -> d.pop(), |
268 |
|
() -> d.descendingIterator().next()); |
269 |
|
} |
270 |
+ |
if (c instanceof List) { |
271 |
+ |
List x = (List) c; |
272 |
+ |
assertThrows( |
273 |
+ |
NoSuchElementException.class, |
274 |
+ |
() -> x.iterator().next(), |
275 |
+ |
() -> x.listIterator().next(), |
276 |
+ |
() -> x.listIterator(0).next(), |
277 |
+ |
() -> x.listIterator().previous(), |
278 |
+ |
() -> x.listIterator(0).previous()); |
279 |
+ |
} |
280 |
|
} |
281 |
|
|
282 |
|
public void testRemoveIf() { |