4242 */
4343public final class CursorIterable <T > implements Iterable <CursorIterable .KeyVal <T >>, AutoCloseable {
4444
45- // private final Comparator<T> comparator;
4645 private final RangeComparator rangeComparator ;
4746 private final Cursor <T > cursor ;
4847 private final KeyVal <T > entry ;
@@ -69,61 +68,6 @@ public final class CursorIterable<T> implements Iterable<CursorIterable.KeyVal<T
6968 }
7069 }
7170
72- // static <T> RangeComparator createJavaRangeComparator(
73- // final KeyRange<T> range,
74- // final Comparator<T> comparator,
75- // final Supplier<T> currentKeySupplier) {
76- // final T start = range.getStart();
77- // final T stop = range.getStop();
78- // return new RangeComparator() {
79- // @Override
80- // public int compareToStartKey() {
81- // return comparator.compare(currentKeySupplier.get(), start);
82- // }
83- //
84- // @Override
85- // public int compareToStopKey() {
86- // return comparator.compare(currentKeySupplier.get(), stop);
87- // }
88- // };
89- // }
90-
91- // /**
92- // * Calls down to mdb_cmp to make use of the comparator that LMDB uses for insertion order.
93- // *
94- // * @param txnPointer The pointer to the transaction.
95- // * @param dbiPointer The pointer to the Dbi so LMDB can use the comparator of the Dbi
96- // * @param proxy
97- // */
98- // private RangeComparator createLmdbDbiComparator(final Pointer txnPointer,
99- // final Pointer dbiPointer,
100- // final Pointer cursorKeyPointer,
101- // final KeyRange<T> range,
102- // final BufferProxy<T> proxy) {
103- // Objects.requireNonNull(txnPointer);
104- // Objects.requireNonNull(dbiPointer);
105- // Objects.requireNonNull(range);
106- // Objects.requireNonNull(cursor);
107- // // Allocate buffers for use with the start/stop keys if required.
108- // // Saves us copying bytes on each comparison
109- // final Key<T> startKey = createKey(range.getStart(), proxy);
110- // final Key<T> stopKey = createKey(range.getStop(), proxy);
111- //
112- // return new RangeComparator() {
113- // @Override
114- // public int compareToStartKey() {
115- // return LIB.mdb_cmp(txnPointer, dbiPointer, cursor.keyVal().pointerKey(),
116- // startKey.pointer());
117- // }
118- //
119- // @Override
120- // public int compareToStopKey() {
121- // return LIB.mdb_cmp(txnPointer, dbiPointer, cursor.keyVal().pointerKey(),
122- // stopKey.pointer());
123- // }
124- // };
125- // }
126-
12771 @ Override
12872 public void close () {
12973 cursor .close ();
0 commit comments