160 |
|
* can be inserted and found. |
161 |
|
*/ |
162 |
|
public void testMixedComparable() { |
163 |
< |
int size = 10000; |
163 |
> |
int size = 1200; // makes measured test run time -> 35ms |
164 |
|
ConcurrentHashMap<Object, Object> map = |
165 |
|
new ConcurrentHashMap<Object, Object>(); |
166 |
< |
Random rng = new Random(1370014958369218000L); |
166 |
> |
Random rng = new Random(); |
167 |
|
for (int i = 0; i < size; i++) { |
168 |
|
Object x; |
169 |
|
switch (rng.nextInt(4)) { |
212 |
|
assertFalse(map2.equals(map1)); |
213 |
|
} |
214 |
|
|
215 |
– |
|
215 |
|
/** |
216 |
< |
* hashCode() equals sum of each key.hashCode ^ value.hashCode |
217 |
< |
*/ |
216 |
> |
* hashCode() equals sum of each key.hashCode ^ value.hashCode |
217 |
> |
*/ |
218 |
|
public void testHashCode() { |
219 |
|
ConcurrentHashMap<Integer,String> map = map5(); |
220 |
|
int sum = 0; |
524 |
|
try { |
525 |
|
new ConcurrentHashMap(-1, .75f); |
526 |
|
shouldThrow(); |
527 |
< |
} catch (IllegalArgumentException e) {} |
528 |
< |
|
527 |
> |
} catch (IllegalArgumentException e) {} |
528 |
> |
|
529 |
|
try { |
530 |
|
new ConcurrentHashMap(16, -1); |
531 |
|
shouldThrow(); |
532 |
< |
} catch (IllegalArgumentException e) {} |
532 |
> |
} catch (IllegalArgumentException e) {} |
533 |
|
} |
534 |
< |
|
535 |
< |
/** |
536 |
< |
* Constructor (initialCapacity, loadFactor, concurrencyLevel) |
537 |
< |
* throws IllegalArgumentException if any argument is negative |
538 |
< |
*/ |
534 |
> |
|
535 |
> |
/** |
536 |
> |
* Constructor (initialCapacity, loadFactor, concurrencyLevel) |
537 |
> |
* throws IllegalArgumentException if any argument is negative |
538 |
> |
*/ |
539 |
|
public void testConstructor3() { |
540 |
< |
try { |
541 |
< |
new ConcurrentHashMap(-1, .75f, 1); |
542 |
< |
shouldThrow(); |
543 |
< |
} catch (IllegalArgumentException e) {} |
544 |
< |
|
545 |
< |
try { |
546 |
< |
new ConcurrentHashMap(16, -1, 1); |
547 |
< |
shouldThrow(); |
548 |
< |
} catch (IllegalArgumentException e) {} |
549 |
< |
|
550 |
< |
try { |
551 |
< |
new ConcurrentHashMap(16, .75f, -1); |
552 |
< |
shouldThrow(); |
553 |
< |
} catch (IllegalArgumentException e) {} |
554 |
< |
} |
540 |
> |
try { |
541 |
> |
new ConcurrentHashMap(-1, .75f, 1); |
542 |
> |
shouldThrow(); |
543 |
> |
} catch (IllegalArgumentException e) {} |
544 |
> |
|
545 |
> |
try { |
546 |
> |
new ConcurrentHashMap(16, -1, 1); |
547 |
> |
shouldThrow(); |
548 |
> |
} catch (IllegalArgumentException e) {} |
549 |
> |
|
550 |
> |
try { |
551 |
> |
new ConcurrentHashMap(16, .75f, -1); |
552 |
> |
shouldThrow(); |
553 |
> |
} catch (IllegalArgumentException e) {} |
554 |
> |
} |
555 |
|
|
556 |
|
/** |
557 |
|
* ConcurrentHashMap(map) throws NullPointerException if the given |