List of usage examples for java.util NavigableSet headSet
NavigableSet<E> headSet(E toElement, boolean inclusive);
From source file:net.sf.jasperreports.engine.export.tabulator.DimensionEntries.java
public DimensionRange<T> getRange(int start, int end) { if (start > end) { throw new IllegalArgumentException(start + " > " + end); }//from www . j a v a 2 s . com if (start <= DimensionEntry.MINUS_INF) { throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_START_OUT_OF_RANGE, new Object[] { start }); } if (end >= DimensionEntry.PLUS_INF) { throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_END_OUT_OF_RANGE, new Object[] { end }); } T startKey = control.entryKey(start); T floor = entries.floor(startKey); assert floor != null; NavigableSet<T> tailSet = entries.tailSet(floor, true); T endKey = control.entryKey(end); T ceiling = tailSet.ceiling(endKey); NavigableSet<T> rangeSet; if (ceiling == null) { rangeSet = tailSet; } else { rangeSet = tailSet.headSet(ceiling, false); } return new DimensionRange<T>(start, end, floor, ceiling, rangeSet); }
From source file:org.apache.hadoop.hbase.regionserver.DefaultMemStore.java
private Member memberOfPreviousRow(NavigableSet<KeyValue> set, final GetClosestRowBeforeTracker state, final KeyValue firstOnRow) { NavigableSet<KeyValue> head = set.headSet(firstOnRow, false); if (head.isEmpty()) return null; for (Iterator<KeyValue> i = head.descendingIterator(); i.hasNext();) { KeyValue found = i.next(); if (state.isExpired(found)) { i.remove();/*from w ww . j ava2 s . c o m*/ continue; } return new Member(head, found); } return null; }