@Benchmark public void kolobokePut() { for (int j = 0; j < LOOP_COUNT; j++) { IntIntMap newMap = HashIntIntMaps.newMutableMap(MAP_SIZE); for (int i = 0; i < KEY_COUNT; i++) { newMap.put(this.kolobokeIntKeysForMap[i], 4); } if (newMap.size() != KEY_COUNT) { throw new AssertionError("size is " + newMap.size()); } } }
/** * Constructs a new empty mutable map of the given expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newMutableMap(int) newMutableMap(expectedSize)}. * * @param expectedSize the expected size of the returned map * @return a new empty mutable map of the given expected size */ @Nonnull public static HashIntIntMap newMutableMap(int expectedSize) { return getDefaultFactory().newMutableMap(expectedSize); }
/** * Constructs a new empty mutable map of the default expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newMutableMap() newMutableMap()}. * * @return a new empty mutable map */ @Nonnull public static HashIntIntMap newMutableMap() { return getDefaultFactory().newMutableMap(); }
/** * Constructs a new empty updatable map of the default expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newUpdatableMap() newUpdatableMap()}. * * @return a new empty updatable map */ @Nonnull public static HashIntIntMap newUpdatableMap() { return getDefaultFactory().newUpdatableMap(); }
@Benchmark public void kolobokePut() { for (int j = 0; j < LOOP_COUNT; j++) { IntIntMap newMap = HashIntIntMaps.newMutableMap(MAP_SIZE); for (int i = 0; i < KEY_COUNT; i++) { newMap.put(this.kolobokeIntKeysForMap[i], 4); } if (newMap.size() != KEY_COUNT) { throw new AssertionError("size is " + newMap.size()); } } }
/** * Constructs a new empty updatable map of the given expected size. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newUpdatableMap(int) newUpdatableMap(expectedSize)}. * * @param expectedSize the expected size of the returned map * @return a new empty updatable map of the given expected size */ @Nonnull public static HashIntIntMap newUpdatableMap(int expectedSize) { return getDefaultFactory().newUpdatableMap(expectedSize); }
@Benchmark public void kolobokeRemove() { for (int j = 0; j < LOOP_COUNT; j++) { IntIntMap newMap = HashIntIntMaps.newMutableMap(this.intIntKoloboke); for (int i = 0; i < KEY_COUNT; i++) { newMap.remove(this.kolobokeIntKeysForMap[i]); } if (newMap.size() != 0) { throw new AssertionError("size is " + newMap.size()); } } }
/** * Constructs a new mutable map of the single specified mapping. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newMutableMapOf(int, int * ) newMutableMapOf(k1, v1)}. * * @param k1 the key of the sole mapping * @param v1 the value of the sole mapping * @return a new mutable map of the single specified mapping */ @Nonnull public static HashIntIntMap newMutableMapOf( int k1, int v1) { return getDefaultFactory().newMutableMapOf(k1, v1); }
@Benchmark public void kolobokeRemove() { for (int j = 0; j < LOOP_COUNT; j++) { IntIntMap newMap = HashIntIntMaps.newMutableMap(this.intIntKoloboke); for (int i = 0; i < KEY_COUNT; i++) { newMap.remove(this.kolobokeIntKeysForMap[i]); } if (newMap.size() != 0) { throw new AssertionError("size is " + newMap.size()); } } }
/** * Constructs a new immutable map of the single specified mapping. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newImmutableMapOf(int, int * ) newImmutableMapOf(k1, v1)}. * * @param k1 the key of the sole mapping * @param v1 the value of the sole mapping * @return a new immutable map of the single specified mapping */ @Nonnull public static HashIntIntMap newImmutableMapOf( int k1, int v1) { return getDefaultFactory().newImmutableMapOf(k1, v1); }
@Setup public void setUp() { this.intIntKoloboke = HashIntIntMaps.newMutableMap(MAP_SIZE); this.intIntGsc = new IntIntHashMap(MAP_SIZE); this.integerIntegerJdk = new HashMap<>(MAP_SIZE); Random random = new Random(0x123456789ABCDL); int[] randomNumbersForMap = this.getRandomKeys(random).toArray(); int number = 23; int lower = Integer.MIN_VALUE; int upper = Integer.MAX_VALUE; this.kolobokeIntKeysForMap = this.fullyRandom ? randomNumbersForMap : this.getKolobokeArray(number, lower, upper, random); this.gscIntKeysForMap = this.fullyRandom ? randomNumbersForMap : this.getGSCArray(number, lower, upper, random); this.jdkIntKeysForMap = this.fullyRandom ? IntIntMapLargeStressTest.boxIntArray(randomNumbersForMap) : this.getJDKArray(lower, upper, random); for (int i = 0; i < KEY_COUNT; i++) { this.intIntKoloboke.put(this.kolobokeIntKeysForMap[i], 5); this.intIntGsc.put(this.gscIntKeysForMap[i], 5); this.integerIntegerJdk.put(this.jdkIntKeysForMap[i], 5); } this.shuffle(this.gscIntKeysForMap, random); this.shuffle(this.kolobokeIntKeysForMap, random); this.shuffle(this.jdkIntKeysForMap, random); }
/** * Constructs a new updatable map of the single specified mapping. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newUpdatableMapOf(int, int * ) newUpdatableMapOf(k1, v1)}. * * @param k1 the key of the sole mapping * @param v1 the value of the sole mapping * @return a new updatable map of the single specified mapping */ @Nonnull public static HashIntIntMap newUpdatableMapOf( int k1, int v1) { return getDefaultFactory().newUpdatableMapOf(k1, v1); }
@Setup public void setUp() { this.intIntKoloboke = HashIntIntMaps.newMutableMap(MAP_SIZE); this.intIntGsc = new IntIntHashMap(MAP_SIZE); this.integerIntegerJdk = new HashMap<>(MAP_SIZE); Random random = new Random(0x123456789ABCDL); int[] randomNumbersForMap = this.getRandomKeys(random).toArray(); int number = 23; int lower = Integer.MIN_VALUE; int upper = Integer.MAX_VALUE; this.kolobokeIntKeysForMap = this.fullyRandom ? randomNumbersForMap : this.getKolobokeArray(number, lower, upper, random); this.gscIntKeysForMap = this.fullyRandom ? randomNumbersForMap : this.getGSCArray(number, lower, upper, random); this.jdkIntKeysForMap = this.fullyRandom ? IntIntMapSmallStressTest.boxIntArray(randomNumbersForMap) : this.getJDKArray(lower, upper, random); for (int i = 0; i < KEY_COUNT; i++) { this.intIntKoloboke.put(this.kolobokeIntKeysForMap[i], 5); this.intIntGsc.put(this.gscIntKeysForMap[i], 5); this.integerIntegerJdk.put(this.jdkIntKeysForMap[i], 5); } this.shuffle(this.gscIntKeysForMap, random); this.shuffle(this.kolobokeIntKeysForMap, random); this.shuffle(this.jdkIntKeysForMap, random); }
/** * 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 HashIntIntMapFactory#newImmutableMap( * Map) newImmutableMap(map)}. * * @param map the map whose mappings are to be placed in the returned map * * @return a new immutable map with the same mappings as the specified {@code map} */ @Nonnull public static HashIntIntMap newImmutableMap( @Nonnull Map<Integer, Integer> map) { return getDefaultFactory().newImmutableMap(map); }
for (int s = 1 << 16; s >= 64; s >>>= 1) { ConcurrentMap<Integer, Integer> map = new ConcurrentHashMap<>(); HashIntIntMap map2 = HashIntIntMaps.newMutableMap(s); int[] array = new int[s]; long t0 = System.nanoTime();
/** * Constructs a new updatable map with the same mappings as the specified {@code map}. * * * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newUpdatableMap( * Map) newUpdatableMap(map)}. * * @param map the map whose mappings are to be placed in the returned map * * @return a new updatable map with the same mappings as the specified {@code map} */ @Nonnull public static HashIntIntMap newUpdatableMap( @Nonnull Map<Integer, Integer> map) { return getDefaultFactory().newUpdatableMap(map); }
protected void _report(int[] aut) { if(_reporter == null) return; int numVertices = pattern.getNumberOfVertices(); HashIntIntMap real_aut = HashIntIntMaps.newMutableMap(numVertices); for (int i = 0; i < numVertices; ++i) { real_aut.put(i, aut[i]); } _reporter.report(real_aut, _reporter_param); }
/** * Constructs a new updatable map of the two specified mappings. * * <p>This method simply delegates to {@link #getDefaultFactory() * }<tt>.</tt>{@link HashIntIntMapFactory#newUpdatableMapOf(int, int, * int, int) 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 * @return a new updatable map of the two specified mappings */ @Nonnull public static HashIntIntMap newUpdatableMapOf( int k1, int v1, int k2, int v2) { return getDefaultFactory().newUpdatableMapOf(k1, v1, k2, v2); }
@Override public IntIntMap getCanonicalLabeling() { if (dirtyCanonicalLabelling) { synchronized (this) { if (dirtyCanonicalLabelling) { if (canonicalLabelling == null) { canonicalLabelling = HashIntIntMaps.newMutableMap(getNumberOfVertices()); } canonicalLabelling.clear(); fillCanonicalLabelling(canonicalLabelling); dirtyCanonicalLabelling = false; } } } return canonicalLabelling; }
/** * Constructs a new updatable 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 HashIntIntMapFactory#newUpdatableMap(Map, * Map, int) newUpdatableMap(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 * @return a new updatable map which merge the mappings of the specified maps */ @Nonnull public static HashIntIntMap newUpdatableMap( @Nonnull Map<Integer, Integer> map1, @Nonnull Map<Integer, Integer> map2, int expectedSize) { return getDefaultFactory().newUpdatableMap(map1, map2, expectedSize); }