GroupTree implements Iterable<TDigest.Group> { public TDigest.Group floor(TDigest.Group base) { if (size == 0) { return null; } else { if (size == 1) { return base.compareTo(leaf) >= 0 ? leaf : null; } else { if (base.compareTo(leaf) < 0) { return left.floor(base); } else { TDigest.Group floor = right.floor(base); if (floor == null) { floor = left.last(); } return floor; } } } } GroupTree();  GroupTree(TDigest.Group leaf);  GroupTree(GroupTree left, GroupTree right); void add(TDigest.Group group); int size(); int headCount(TDigest.Group base); int headSum(TDigest.Group base); TDigest.Group first(); Iterator<TDigest.Group> iterator(); void remove(TDigest.Group base); TDigest.Group floor(TDigest.Group base); TDigest.Group last(); TDigest.Group ceiling(TDigest.Group base); Iterable<TDigest.Group> tailSet(final TDigest.Group start); int sum(); void checkBalance(); void print(int depth);  }
@Test public void testFloor() { GroupTree x = new GroupTree(); for (int i = 0; i < 101; i++) { x.add(new TDigest.Group(i / 2)); } assertNull(x.floor(new TDigest.Group(-30))); }