Debian Codegraph @

hppc-benchmarks/src/main/java/com/carrotsearch/hppc/benchmarks/implementations/HppcIntSetOps.java

raw
1 package com.carrotsearch.hppc.benchmarks.implementations;
2
3 import com.carrotsearch.hppc.IntHashSet;
4 import com.carrotsearch.hppc.benchmarks.IntSetOps;
5
6 public class HppcIntSetOps implements IntSetOps {
7 private final IntHashSet delegate;
8
9 public HppcIntSetOps(int expectedElements, double loadFactor) {
10 this.delegate = new IntHashSet(expectedElements, loadFactor);
11 }
12
13 @Override
14 public void add(int key) {
15 delegate.add(key);
16 }
17
18 @Override
19 public void bulkAdd(int[] keys) {
20 for (int key : keys) {
21 delegate.add(key);
22 }
23 }
24
25 @Override
26 public int bulkContains(int[] keys) {
27 int v = 0;
28 for (int key : keys) {
29 if (delegate.contains(key)) {
30 v++;
31 }
32 }
33 return v;
34 }
35
36 @Override
37 public int[] iterationOrderArray() {
38 return delegate.toArray();
39 }
40 }