public static <T, U> ImmutableMap<T, U> asImmutableMap( Map<T, U> map ) { return ImmutableMapFactoryImpl.INSTANCE.ofAll( map ); }
@Override public <K, V> ImmutableMap<K, V> with() { return this.empty(); }
@Override public <K, V> ImmutableMap<K, V> of(K key1, V value1, K key2, V value2) { return this.with(key1, value1, key2, value2); }
return this.of(); return this.of(entries[0].getKey(), entries[0].getValue()); case 2: return this.of( entries[0].getKey(), entries[0].getValue(), entries[1].getKey(), entries[1].getValue()); case 3: return this.of( entries[0].getKey(), entries[0].getValue(), entries[1].getKey(), entries[1].getValue(), entries[2].getKey(), entries[2].getValue()); case 4: return this.of( entries[0].getKey(), entries[0].getValue(), entries[1].getKey(), entries[1].getValue(),
@Override public <K, V> ImmutableMap<K, V> ofAll(Map<K, V> map) { return this.withAll(map); }
return this.of(); return this.of(entries[0].getKey(), entries[0].getValue()); case 2: return this.of( entries[0].getKey(), entries[0].getValue(), entries[1].getKey(), entries[1].getValue()); case 3: return this.of( entries[0].getKey(), entries[0].getValue(), entries[1].getKey(), entries[1].getValue(), entries[2].getKey(), entries[2].getValue()); case 4: return this.of( entries[0].getKey(), entries[0].getValue(), entries[1].getKey(), entries[1].getValue(),
@Override public <K, V> ImmutableMap<K, V> ofAll(Map<K, V> map) { return this.withAll(map); }
@Override public <K, V> ImmutableMap<K, V> with(K key1, V value1, K key2, V value2) { if (Comparators.nullSafeEquals(key1, key2)) { return this.of(key1, value2); } return new ImmutableDoubletonMap<>(key1, value1, key2, value2); }
@Override public <K, V> ImmutableMap<K, V> of(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4) { return this.with(key1, value1, key2, value2, key3, value3, key4, value4); }
/** * @deprecated use {@link #ofAll(Map)} instead (inlineable) */ @Override @Deprecated public <K, V> ImmutableMap<K, V> ofMap(Map<K, V> map) { return this.ofAll(map); }
@Override public <K, V> ImmutableMap<K, V> of() { return this.empty(); }
@Override public <K, V> ImmutableMap<K, V> ofAll(Map<K, V> map) { return this.withAll(map); }
@Override public <K, V> ImmutableMap<K, V> with(K key1, V value1, K key2, V value2) { if (Comparators.nullSafeEquals(key1, key2)) { return this.of(key1, value2); } return new ImmutableDoubletonMap<>(key1, value1, key2, value2); }
@Override public <K, V> ImmutableMap<K, V> of(K key, V value) { return this.with(key, value); }
/** * @deprecated use {@link #ofAll(Map)} instead (inlineable) */ @Override @Deprecated public <K, V> ImmutableMap<K, V> ofMap(Map<K, V> map) { return this.ofAll(map); }
@Override public <K, V> ImmutableMap<K, V> of() { return this.empty(); }
@Override public <K, V> ImmutableMap<K, V> with(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4) { if (Comparators.nullSafeEquals(key1, key2)) { return this.of(key1, value2, key3, value3, key4, value4); } if (Comparators.nullSafeEquals(key1, key3)) { return this.of(key2, value2, key1, value3, key4, value4); } if (Comparators.nullSafeEquals(key1, key4)) { return this.of(key2, value2, key3, value3, key1, value4); } if (Comparators.nullSafeEquals(key2, key3)) { return this.of(key1, value1, key2, value3, key4, value4); } if (Comparators.nullSafeEquals(key2, key4)) { return this.of(key1, value1, key3, value3, key2, value4); } if (Comparators.nullSafeEquals(key3, key4)) { return this.of(key1, value1, key2, value2, key3, value4); } return new ImmutableQuadrupletonMap<>(key1, value1, key2, value2, key3, value3, key4, value4); }
@Override public <K, V> ImmutableMap<K, V> of(K key1, V value1, K key2, V value2, K key3, V value3) { return this.with(key1, value1, key2, value2, key3, value3); }
public static <T, U> ImmutableMap<T, U> asImmutableMap( Map<T, U> map ) { return ImmutableMapFactoryImpl.INSTANCE.ofAll( map ); }
@Override public <K, V> ImmutableMap<K, V> with() { return this.empty(); }