CompactList implements Iterable<MutableDirectBuffer>, CloseableSilently { public int find(final DirectBuffer key, final Comparator<DirectBuffer> c) { int low = 0; int high = size() - 1; while (low <= high) { final int mid = (low + high) >>> 1; wrap(mid, elementBuffer); final int cmp = c.compare(elementBuffer, key); if (cmp < 0) { low = mid + 1; } else if (cmp > 0) { high = mid - 1; } else { return mid; } } return -(low + 1); } CompactList(
      final int elementMaxLength, final int capacity, final BufferAllocator bufferAllocator);  CompactList(
      final AllocatedBuffer allocatedBuffer, final int elementMaxLength, final int capacity);  CompactList(final UnsafeBuffer listBuffer); void add(final DirectBuffer srcBuffer); void add(final DirectBuffer srcBuffer, final int offset, final int length); void add(final DirectBuffer srcBuffer, final int offset, final int length, final int idx); void set(final int idx, final DirectBuffer srcBuffer); void set(final int idx, final DirectBuffer srcBuffer, final int offset, final int length); void remove(final int idx); int size(); int sizeVolatile(); int capacity(); int maxElementDataLength(); int get(final int idx, final MutableDirectBuffer dstBuffer, final int offset); int wrap(final int idx, final MutableDirectBuffer dstBuffer); int getEncodedSize(); DirectBuffer getRawBuffer(); int find(final DirectBuffer key, final Comparator<DirectBuffer> c); int copyInto(final MutableDirectBuffer dstBuffer, final int offset); void clear(); @Override CompactListIterator iterator(); InputStream toInputStream(); @Override void close();  }
@Test public void shouldFindElement() { addValues(); final UnsafeBuffer keyBuffer = new UnsafeBuffer(new byte[SIZE_OF_INT]); keyBuffer.putInt(0, 7); final int idx = list.find( keyBuffer, new Comparator<DirectBuffer>() { @Override public int compare(final DirectBuffer o1, final DirectBuffer o2) { return Integer.compare(o1.getInt(0), o2.getInt(0)); } }); assertThat(idx).isEqualTo(7); }