com.carrotsearch.hppc.LongByteScatterMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of driver-cql-shaded Show documentation
Show all versions of driver-cql-shaded Show documentation
A Shaded CQL ActivityType driver for http://nosqlbench.io/
package com.carrotsearch.hppc;
import static com.carrotsearch.hppc.Containers.*;
import static com.carrotsearch.hppc.HashContainers.*;
/**
* Same as {@link LongByteHashMap} but does not implement per-instance
* key mixing strategy and uses a simpler (faster) bit distribution function.
*
* Note: read about
* important differences
* between hash and scatter sets.
*/
@javax.annotation.Generated(
date = "2015-05-07T09:33:04+0200",
value = "KTypeVTypeScatterMap.java")
public class LongByteScatterMap extends LongByteHashMap
{
/**
* New instance with sane defaults.
*/
public LongByteScatterMap() {
this(DEFAULT_EXPECTED_ELEMENTS);
}
/**
* New instance with sane defaults.
*/
public LongByteScatterMap(int expectedElements) {
this(expectedElements, DEFAULT_LOAD_FACTOR);
}
/**
* New instance with sane defaults.
*/
@SuppressWarnings("deprecation")
public LongByteScatterMap(int expectedElements, double loadFactor) {
super(expectedElements, loadFactor, HashOrderMixing.none());
}
protected
int hashKey(long key) {
return BitMixer.mixPhi(key);
}
/**
* Creates a hash map from two index-aligned arrays of key-value pairs.
*/
public static LongByteScatterMap from(long[] keys, byte[] values) {
if (keys.length != values.length) {
throw new IllegalArgumentException("Arrays of keys and values must have an identical length.");
}
LongByteScatterMap map = new LongByteScatterMap(keys.length);
for (int i = 0; i < keys.length; i++) {
map.put(keys[i], values[i]);
}
return map;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy