Skip to content

Commit 70b7745

Browse files
committed
always return new KeyVal from cursor
1 parent c3929c1 commit 70b7745

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/main/java/org/lmdbjava/Cursor.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public final class Cursor<T> implements AutoCloseable {
3636
private boolean closed;
3737
private final Pointer ptrCursor;
3838
private Txn<T> txn;
39-
private KeyVal<T> keyVal = new KeyVal<>(null, null);
4039

4140
Cursor(final Pointer ptr, final Txn<T> txn) {
4241
requireNonNull(ptr);
@@ -249,8 +248,7 @@ public T val() {
249248
* @return the key and value that the cursor is located at.
250249
*/
251250
public KeyVal<T> keyVal() {
252-
keyVal.wrap(key(), val());
253-
return keyVal;
251+
return new KeyVal<>(key(), val());
254252
}
255253

256254
/**

0 commit comments

Comments
 (0)