use of org.neo4j.collection.primitive.hopscotch.HopScotchHashingAlgorithm.Monitor in project neo4j by neo4j.
the class HopScotchHashingAlgorithmTest method figureOutGrowthThreshold.
private int figureOutGrowthThreshold() {
final AtomicBoolean grew = new AtomicBoolean();
Monitor monitor = new Monitor.Adapter() {
@Override
public boolean tableGrew(int fromCapacity, int toCapacity, int currentSize) {
grew.set(true);
return true;
}
};
try (PrimitiveLongSet set = new PrimitiveLongHashSet(new LongKeyTable<>(DEFAULT_H, VALUE_MARKER), VALUE_MARKER, monitor)) {
int i = 0;
for (i = 0; !grew.get(); i++) {
set.add(i * 3);
}
return i;
}
}
Aggregations