Collection<V> () { if (values == null) { values = new AbstractCollection<V>() { @Override public @NotNull Iterator<V> iterator() { return new MyIterator<V>() { @Override V fieldElement(int offset) { return offset == 0 ? v1 : offset == 1 ? v2 : v3; } @SuppressWarnings("unchecked") @Override V tableElement(int offset) { return (V)data[offset + 1]; } }; } @Override public void forEach(Consumer<? super V> action) { if (k1 != null) { if (k2 != null) { if (k3 != null) { action.accept(v3); } action.accept(v2); } action.accept(v1); } for (int i = 0; i < data.length; i += 2) { Object key = data[i]; if (key != null) { @SuppressWarnings("unchecked") V v = (V)data[i + 1]; action.accept(v); } } } @Override public boolean contains(Object o) { return containsValue(o); } @Override public int size() { return UnmodifiableHashMap.this.size(); } }; } return values; }