180 |
|
return a; |
181 |
|
} |
182 |
|
|
183 |
< |
/* |
183 |
> |
/** |
184 |
|
* replaceAll replaces all matching values. |
185 |
|
*/ |
186 |
|
public void testReplaceAll() { |
187 |
|
ConcurrentHashMap<Integer, String> map = map5(); |
188 |
< |
map.replaceAll((x, y) -> {return x > 3 ? "Z" : y;}); |
188 |
> |
map.replaceAll((x, y) -> { return x > 3 ? "Z" : y; }); |
189 |
|
assertEquals("A", map.get(one)); |
190 |
|
assertEquals("B", map.get(two)); |
191 |
|
assertEquals("C", map.get(three)); |
223 |
|
assertFalse(set2.contains(six)); |
224 |
|
} |
225 |
|
|
226 |
– |
|
226 |
|
/** |
227 |
|
* keySet.addAll adds each element from the given collection |
228 |
|
*/ |
419 |
|
assertTrue(it.hasNext()); |
420 |
|
it.next(); |
421 |
|
} |
422 |
< |
assertFalse(it.hasNext()); |
423 |
< |
try { |
424 |
< |
it.next(); |
425 |
< |
shouldThrow(); |
426 |
< |
} catch (NoSuchElementException success) {} |
422 |
> |
assertIteratorExhausted(it); |
423 |
> |
} |
424 |
> |
|
425 |
> |
/** |
426 |
> |
* iterator of empty collections has no elements |
427 |
> |
*/ |
428 |
> |
public void testEmptyIterator() { |
429 |
> |
assertIteratorExhausted(ConcurrentHashMap.newKeySet().iterator()); |
430 |
> |
assertIteratorExhausted(new ConcurrentHashMap().entrySet().iterator()); |
431 |
> |
assertIteratorExhausted(new ConcurrentHashMap().values().iterator()); |
432 |
> |
assertIteratorExhausted(new ConcurrentHashMap().keySet().iterator()); |
433 |
|
} |
434 |
|
|
435 |
|
/** |
1008 |
|
public void testSearchValuesSequentially() { |
1009 |
|
ConcurrentHashMap<Long, Long> m = longMap(); |
1010 |
|
Long r; |
1011 |
< |
r = m.searchValues(Long.MAX_VALUE, (Long x) -> x.longValue() == (long)(SIZE/2)? x : null); |
1011 |
> |
r = m.searchValues(Long.MAX_VALUE, |
1012 |
> |
(Long x) -> (x.longValue() == (long)(SIZE/2)) ? x : null); |
1013 |
|
assertEquals((long)r, (long)(SIZE/2)); |
1014 |
< |
r = m.searchValues(Long.MAX_VALUE, (Long x) -> x.longValue() < 0L ? x : null); |
1014 |
> |
r = m.searchValues(Long.MAX_VALUE, |
1015 |
> |
(Long x) -> (x.longValue() < 0L) ? x : null); |
1016 |
|
assertNull(r); |
1017 |
|
} |
1018 |
|
|