KeyFMap (@NotNull Key<?> key) { int oldSize = size(); int keyCode = key.hashCode(); if (!containsKey(keyCode)) { return this; } if (oldSize == ArrayBackedFMap.ARRAY_THRESHOLD + 1) { int[] keys = keySet().toIntArray(); int[] newKeys = ArrayUtil.remove(keys, ArrayUtil.indexOf(keys, keyCode)); Arrays.sort(newKeys); Object[] newValues = new Object[newKeys.length]; for (int i = 0; i < newKeys.length; i++) { Object value = get(newKeys[i]); assert value != null; newValues[i] = value; } return new ArrayBackedFMap(newKeys, newValues); } return new MapBackedFMap(this, keyCode); }