@Override public Map<K, V> expandForNextKeyIfNeeded(K newElem) { if (key == null || key.equals(newElem)) { return this; } return new TinyTwoValuesMap<K, V>(this); } }
TinyArrayMap(TinyTwoValuesMap<K, V> twoValues, int capacity) { assert capacity >= 2; keyValues = new Object[capacity*2]; this.size = twoValues.size(); int index = 0; this.keyValues[index++] = twoValues.getFirstKey(); this.keyValues[index++] = twoValues.getFirstValue(); this.keyValues[index++] = twoValues.getSecondKey(); this.keyValues[index] = twoValues.getSecondValue(); }
} else { return new Set<Entry<K, V>>() { final int size = TinyTwoValuesMap.this.size(); @Override public int size() {
return new TinySingletonMap<K, V>(); case 2: return new TinyTwoValuesMap<K, V>(); case 3: case 4: