MemberHolder { public int containsCount(int listId, long member) { if (listId>=data.length) { return 0; } ByteBuffer buff = data[listId]; ((Buffer)buff).flip(); int found = 0; while (buff.hasRemaining()) { if (member == VarLenLong.readLongSigned(buff)) { found++; } } ((Buffer)buff).limit(buff.capacity()); return found; } MemberHolder(int maxSets);  MemberHolder(int maxLists, int initBytesPerSet); void addMember(int listId, long member); boolean removeMember(int listId, long member); boolean isEmpty(int listId); int containsCount(int listId, long member); void visit(int listId, MemberHolderVisitor visitor);  }
@Test public void testContainsMembers() { MemberHolder holder = new MemberHolder(10); final int listId = 3; final int seed = 42; Random r = new Random(seed); populate(holder, listId, r); final Random expectedR = new Random(seed); int c = 0; if (++c<100000) { assertTrue(holder.containsCount(listId, expectedR.nextInt(c))>0); } else { long lng = expectedR.nextLong() & 0x7FFFFFFFFFFFFFFFl; assertTrue(holder.containsCount(listId, lng)>0); } }