### Question:
ArrayMap { public ArrayMap() { useThreadSafeMap = false; arrayEntries = new ArrayEntry[toMapThreshold]; } ArrayMap();  ArrayMap( int mapThreshold, boolean threadSafe, boolean shrinkToArray ); void put( K key, V value ); V get( K key ); V remove( K key ); Iterable<K> keySet(); Iterable<V> values(); Set<Entry<K,V>> entrySet(); int size(); void clear();  }### Answer:
@Test public void testArrayMap() { ArrayMap<String,Integer> map = new ArrayMap<String,Integer>(); assertTrue( map.get( "key1" ) == null ); map.put( "key1", 0 ); assertEquals( new Integer(0), map.get( "key1" ) ); assertEquals( new Integer(0), map.get( "key1" ) ); map.put( "key1", 1 ); assertEquals( new Integer(1), map.get( "key1" ) ); map.put( "key2", 0 ); assertEquals( new Integer(0), map.get( "key2" ) ); map.put( "key2", 2 ); assertEquals( new Integer(2), map.get( "key2" ) ); assertEquals( new Integer(2), map.remove( "key2" ) ); assertTrue( map.get( "key2" ) == null ); assertEquals( new Integer(1), map.get( "key1" ) ); assertEquals( new Integer(1), map.remove( "key1" ) ); assertTrue( map.get( "key1" ) == null ); map.put( "key1", 1 ); map.put( "key2", 2 ); map.put( "key3", 3 ); map.put( "key4", 4 ); map.put( "key5", 5 ); assertEquals( new Integer(5), map.get( "key5" ) ); assertEquals( new Integer(4), map.get( "key4" ) ); assertEquals( new Integer(3), map.get( "key3" ) ); assertEquals( new Integer(2), map.get( "key2" ) ); assertEquals( new Integer(1), map.get( "key1" ) ); assertEquals( new Integer(5), map.remove( "key5" ) ); assertEquals( new Integer(1), map.get( "key1" ) ); assertEquals( new Integer(4), map.get( "key4" ) ); assertEquals( new Integer(3), map.get( "key3" ) ); assertEquals( new Integer(2), map.get( "key2" ) ); assertEquals( new Integer(3), map.remove( "key3" ) ); assertEquals( new Integer(1), map.remove( "key1" ) ); assertEquals( new Integer(2), map.remove( "key2" ) ); for ( int i = 0; i < 100; i++ ) { map.put( "key" + i, i ); } for ( int i = 0; i < 100; i++ ) { assertEquals( new Integer(i), map.get( "key" + i) ); } for ( int i = 0; i < 100; i++ ) { assertEquals( new Integer(i), map.remove( "key" + i) ); } for ( int i = 0; i < 100; i++ ) { assertTrue( map.get( "key" + i ) == null ); } }