IndexV2 implements Index { @Override public Set<UUID> getUUIDs() { Set<UUID> uuids = newHashSetWithExpectedSize(entries.remaining() / IndexEntryV2.SIZE); int position = entries.position(); while (position < entries.limit()) { long msb = entries.getLong(position); long lsb = entries.getLong(position + 8); uuids.add(new UUID(msb, lsb)); position += IndexEntryV2.SIZE; } return uuids; } IndexV2(Buffer entries); @Override Set<UUID> getUUIDs(); @Override int findEntry(long msb, long lsb); @Override int size(); @Override int count(); @Override IndexEntryV2 entry(int i);  }
@Test public void testGetUUIDs() throws Exception { Buffer buffer = Buffer.allocate(2 * IndexEntryV2.SIZE); buffer.duplicate() .putLong(1).putLong(2).putInt(3).putInt(4).putInt(5).putInt(6).put((byte) 0) .putLong(7).putLong(8).putInt(9).putInt(10).putInt(11).putInt(12).put((byte) 1); Set<UUID> expected = new HashSet<>(); expected.add(new UUID(1, 2)); expected.add(new UUID(7, 8)); assertEquals(expected, new IndexV2(buffer).getUUIDs()); }