1 |
/* |
2 |
* Written by Doug Lea and Martin Buchholz with assistance from |
3 |
* members of JCP JSR-166 Expert Group and released to the public |
4 |
* domain, as explained at |
5 |
* http://creativecommons.org/publicdomain/zero/1.0/ |
6 |
*/ |
7 |
|
8 |
import java.util.Map; |
9 |
|
10 |
/** Allows tests to work with different Map implementations. */ |
11 |
public interface MapImplementation { |
12 |
/** Returns the Map implementation class. */ |
13 |
public Class<?> klazz(); |
14 |
/** Returns an empty map. */ |
15 |
public Map emptyMap(); |
16 |
|
17 |
// General purpose implementations can use Integers for key and value |
18 |
default Object makeKey(int i) { return i; } |
19 |
default Object makeValue(int i) { return i; } |
20 |
default int keyToInt(Object key) { return (Integer) key; } |
21 |
default int valueToInt(Object value) { return (Integer) value; } |
22 |
|
23 |
public boolean isConcurrent(); |
24 |
default boolean remappingFunctionCalledAtMostOnce() { return true; }; |
25 |
public boolean permitsNullKeys(); |
26 |
public boolean permitsNullValues(); |
27 |
public boolean supportsSetValue(); |
28 |
} |