/** * Constructs a new empty mutable map of the default expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newMutableMap() newMutableMap()}. * * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new empty mutable map */ @Nonnull public static <K, V> HashObjObjMap<K, V> newMutableMap() { return getDefaultFactory().<K, V>newMutableMap(); }
boolean keySpecialEquals(HashObjObjMapFactory<?, ?> other) { return getKeyEquivalence().equals(other.getKeyEquivalence()) && isNullKeyAllowed() == other.isNullKeyAllowed(); }
/** * Constructs a new immutable map with the same mappings as the specified {@code map}. * * * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newImmutableMap( * Map) newImmutableMap(map)}. * * @param map the map whose mappings are to be placed in the returned map * * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new immutable map with the same mappings as the specified {@code map} */ @Nonnull public static <K, V> HashObjObjMap<K, V> newImmutableMap( @Nonnull Map<? extends K, ? extends V> map) { return getDefaultFactory().<K, V>newImmutableMap(map); }
protected <T, V> Map<T, V> makeMap( final int size, final float fillFactor ) { return HashObjObjMaps.getDefaultFactory().withNullKeyAllowed(false). withHashConfig(HashConfig.fromLoads(fillFactor/2, fillFactor, fillFactor)).newMutableMap(size); } }
protected <T, V> Map<T, V> makeMap( final int size, final float fillFactor ) { return HashObjObjMaps.getDefaultFactory() .withHashConfig(HashConfig.fromLoads(fillFactor / 2, fillFactor, fillFactor)) .withKeyEquivalence(HashCodeMixingEquivalence.INSTANCE) .newMutableMap(size); } }
protected <T, V> Map<T, V> makeMap( final int size, final float fillFactor ) { return HashObjObjMaps.getDefaultFactory(). withHashConfig(HashConfig.fromLoads(fillFactor/2, fillFactor, fillFactor)).newMutableMap(size); }
/** * Constructs a new empty updatable map of the default expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newUpdatableMap() newUpdatableMap()}. * * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new empty updatable map */ @Nonnull public static <K, V> HashObjObjMap<K, V> newUpdatableMap() { return getDefaultFactory().<K, V>newUpdatableMap(); }
/** * Constructs a new updatable map of the single specified mapping. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newUpdatableMapOf(Object, Object * ) newUpdatableMapOf(k1, v1)}. * * @param k1 the key of the sole mapping * @param v1 the value of the sole mapping * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new updatable map of the single specified mapping */ @Nonnull public static <K, V> HashObjObjMap<K, V> newUpdatableMapOf( K k1, V v1) { return getDefaultFactory().<K, V>newUpdatableMapOf(k1, v1); }
/** * Constructs a new mutable map of the single specified mapping. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newMutableMapOf(Object, Object * ) newMutableMapOf(k1, v1)}. * * @param k1 the key of the sole mapping * @param v1 the value of the sole mapping * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new mutable map of the single specified mapping */ @Nonnull public static <K, V> HashObjObjMap<K, V> newMutableMapOf( K k1, V v1) { return getDefaultFactory().<K, V>newMutableMapOf(k1, v1); }
/** * Constructs a new immutable map of the single specified mapping. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newImmutableMapOf(Object, Object * ) newImmutableMapOf(k1, v1)}. * * @param k1 the key of the sole mapping * @param v1 the value of the sole mapping * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new immutable map of the single specified mapping */ @Nonnull public static <K, V> HashObjObjMap<K, V> newImmutableMapOf( K k1, V v1) { return getDefaultFactory().<K, V>newImmutableMapOf(k1, v1); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof HashObjObjMapFactory) { HashObjObjMapFactory factory = (HashObjObjMapFactory) obj; return commonEquals(factory) && keySpecialEquals(factory) && getValueEquivalence().equals(factory.getValueEquivalence()) ; } else { return false; } }
/** * Constructs a new empty updatable map of the given expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newUpdatableMap(int) newUpdatableMap(expectedSize)}. * * @param expectedSize the expected size of the returned map * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new empty updatable map of the given expected size */ @Nonnull public static <K, V> HashObjObjMap<K, V> newUpdatableMap(int expectedSize) { return getDefaultFactory().<K, V>newUpdatableMap(expectedSize); }
private static <T, V> Map<T, V> makeMap( final int size, final float fillFactor ) { return HashObjObjMaps.getDefaultFactory().withKeyEquivalence( Equivalence.identity() ). withHashConfig(HashConfig.fromLoads(fillFactor/2, fillFactor, fillFactor)).newMutableMap(size); }
/** * Constructs a new updatable map of the two specified mappings. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newUpdatableMapOf(Object, Object, * Object, Object) newUpdatableMapOf(k1, v1, k2, v2)}. * * @param k1 the key of the first mapping * @param v1 the value of the first mapping * @param k2 the key of the second mapping * @param v2 the value of the second mapping * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new updatable map of the two specified mappings */ @Nonnull public static <K, V> HashObjObjMap<K, V> newUpdatableMapOf( K k1, V v1, K k2, V v2) { return getDefaultFactory().<K, V>newUpdatableMapOf(k1, v1, k2, v2); }
/** * Constructs a new mutable map of the two specified mappings. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newMutableMapOf(Object, Object, * Object, Object) newMutableMapOf(k1, v1, k2, v2)}. * * @param k1 the key of the first mapping * @param v1 the value of the first mapping * @param k2 the key of the second mapping * @param v2 the value of the second mapping * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new mutable map of the two specified mappings */ @Nonnull public static <K, V> HashObjObjMap<K, V> newMutableMapOf( K k1, V v1, K k2, V v2) { return getDefaultFactory().<K, V>newMutableMapOf(k1, v1, k2, v2); }
/** * Constructs a new immutable map of the two specified mappings. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newImmutableMapOf(Object, Object, * Object, Object) newImmutableMapOf(k1, v1, k2, v2)}. * * @param k1 the key of the first mapping * @param v1 the value of the first mapping * @param k2 the key of the second mapping * @param v2 the value of the second mapping * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new immutable map of the two specified mappings */ @Nonnull public static <K, V> HashObjObjMap<K, V> newImmutableMapOf( K k1, V v1, K k2, V v2) { return getDefaultFactory().<K, V>newImmutableMapOf(k1, v1, k2, v2); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof HashObjObjMapFactory) { HashObjObjMapFactory factory = (HashObjObjMapFactory) obj; return commonEquals(factory) && keySpecialEquals(factory) && getValueEquivalence().equals(factory.getValueEquivalence()) ; } else { return false; } }
/** * Constructs a new empty mutable map of the given expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newMutableMap(int) newMutableMap(expectedSize)}. * * @param expectedSize the expected size of the returned map * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new empty mutable map of the given expected size */ @Nonnull public static <K, V> HashObjObjMap<K, V> newMutableMap(int expectedSize) { return getDefaultFactory().<K, V>newMutableMap(expectedSize); }
/** * Constructs a new immutable map which merge the mappings of the specified maps. On conflict, * mappings from the {@code map2} have priority over mappings from the {@code map1} with * the same keys. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newImmutableMap(Map, * Map, int) newImmutableMap(map1, map2, expectedSize)}. * * @param map1 the first map to merge * @param map2 the second map to merge * @param expectedSize the expected size of the returned map * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new immutable map which merge the mappings of the specified maps */ @Nonnull public static <K, V> HashObjObjMap<K, V> newImmutableMap( @Nonnull Map<? extends K, ? extends V> map1, @Nonnull Map<? extends K, ? extends V> map2, int expectedSize) { return getDefaultFactory().<K, V>newImmutableMap(map1, map2, expectedSize); }
/** * Constructs a new empty updatable map of the default expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashObjObjMapFactory#newUpdatableMap() newUpdatableMap()}. * * @param <K> the key type of the returned map * @param <V> the value type of the returned map * @return a new empty updatable map */ @Nonnull public static <K, V> HashObjObjMap<K, V> newUpdatableMap() { return getDefaultFactory().<K, V>newUpdatableMap(); }