Java Code Examples for org.agrona.collections.IntHashSet#contains()

The following examples show how to use org.agrona.collections.IntHashSet#contains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Common.java    From benchmarks with Apache License 2.0 5 votes vote down vote up
public void setup(final BenchmarkParams b) throws IOException {
  keySize = intKey ? BYTES : STRING_KEY_LENGTH;
  crc = new CRC32();
  final IntHashSet set = new IntHashSet(num);
  keys = new int[num];
  for (int i = 0; i < num; i++) {
    if (sequential) {
      keys[i] = i;
    } else {
      while (true) {
        int candidateKey = RND.nextInt();
        if (candidateKey < 0) {
          candidateKey *= -1;
        }
        if (!set.contains(candidateKey)) {
          set.add(candidateKey);
          keys[i] = candidateKey;
          break;
        }
      }
    }
  }

  rmdir(TMP_BENCH);
  tmp = create(b, "");
  compact = create(b, "-compacted");
}
 
Example 2
Source File: LongDictionary.java    From artio with Apache License 2.0 4 votes vote down vote up
public boolean contains(final long key, final int value)
{
    final IntHashSet fields = values(key);
    return fields != null && fields.contains(value);
}
 
Example 3
Source File: OtfParser.java    From artio with Apache License 2.0 4 votes vote down vote up
private boolean isEndOfGroup(final IntHashSet groupFields)
{
    return !groupFields.contains(tag);
}