### Question:
SplitMapUtils { @SuppressWarnings("unchecked") public static <K, V> IterableMap<K, V> readableMap(final Get<K, V> get) { if (get == null) { throw new NullPointerException("Get must not be null"); } if (get instanceof Map) { return get instanceof IterableMap ? ((IterableMap<K, V>) get) : MapUtils.iterableMap((Map<K, V>) get); } return new WrappedGet<K, V>(get); } private  SplitMapUtils(); @SuppressWarnings("unchecked") static IterableMap<K, V> readableMap(final Get<K, V> get); @SuppressWarnings("unchecked") static Map<K, V> writableMap(final Put<K, V> put);  }### Answer:
@Test public void testReadableMap() { final IterableMap<String, Integer> map = SplitMapUtils.readableMap(transformedMap); for (int i = 0; i < 10; i++) { assertFalse(map.containsValue(String.valueOf(i))); assertEquals(i, map.get(String.valueOf(i)).intValue()); } final MapIterator<String, Integer> it = map.mapIterator(); while (it.hasNext()) { final String k = it.next(); assertEquals(k, it.getKey()); assertEquals(Integer.valueOf(k), it.getValue()); } assertTrue(map instanceof Unmodifiable); int sz = map.size(); attemptPutOperation(new Runnable() { public void run() { map.clear(); } }); assertEquals(sz, map.size()); attemptPutOperation(new Runnable() { public void run() { map.put("foo", 100); } }); final HashMap<String, Integer> m = new HashMap<String, Integer>(); m.put("foo", 100); m.put("bar", 200); m.put("baz", 300); attemptPutOperation(new Runnable() { public void run() { map.putAll(m); } }); final IterableMap<String, Integer> other = SplitMapUtils.readableMap(transformedMap); assertEquals(other, map); assertEquals(other.hashCode(), map.hashCode()); for (int i = 0; i < 10; i++) { assertEquals(i, map.remove(String.valueOf(i)).intValue()); assertEquals(--sz, map.size()); } assertTrue(map.isEmpty()); assertSame(map, SplitMapUtils.readableMap(map)); }
@Test public void testAlreadyReadableMap() { final HashedMap<String, Integer> hashedMap = new HashedMap<String, Integer>(); assertSame(hashedMap, SplitMapUtils.readableMap(hashedMap)); }