1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
* Other contributors include Andrew Wright, Jeffrey Hayes, |
6 |
|
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
233 |
|
public void testRemoveElement() { |
234 |
|
LinkedList q = populatedQueue(SIZE); |
235 |
|
for (int i = 1; i < SIZE; i+=2) { |
236 |
< |
assertTrue(q.remove(new Integer(i))); |
236 |
> |
assertTrue(q.contains(i)); |
237 |
> |
assertTrue(q.remove((Integer)i)); |
238 |
> |
assertFalse(q.contains(i)); |
239 |
> |
assertTrue(q.contains(i-1)); |
240 |
|
} |
241 |
|
for (int i = 0; i < SIZE; i+=2) { |
242 |
< |
assertTrue(q.remove(new Integer(i))); |
243 |
< |
assertFalse(q.remove(new Integer(i+1))); |
242 |
> |
assertTrue(q.contains(i)); |
243 |
> |
assertTrue(q.remove((Integer)i)); |
244 |
> |
assertFalse(q.contains(i)); |
245 |
> |
assertFalse(q.remove((Integer)(i+1))); |
246 |
> |
assertFalse(q.contains(i+1)); |
247 |
|
} |
248 |
|
assertTrue(q.isEmpty()); |
249 |
|
} |