diff options
Diffstat (limited to 'subprojects/store')
-rw-r--r-- | subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java b/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java new file mode 100644 index 00000000..fc8e628b --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java | |||
@@ -0,0 +1,36 @@ | |||
1 | package tools.refinery.store.map; | ||
2 | |||
3 | public final class Cursors { | ||
4 | private Cursors() { | ||
5 | throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); | ||
6 | } | ||
7 | |||
8 | public static <K, V> Cursor<K, V> empty() { | ||
9 | return new Empty<>(); | ||
10 | } | ||
11 | |||
12 | private static class Empty<K, V> implements Cursor<K, V> { | ||
13 | private boolean terminated = false; | ||
14 | |||
15 | @Override | ||
16 | public K getKey() { | ||
17 | return null; | ||
18 | } | ||
19 | |||
20 | @Override | ||
21 | public V getValue() { | ||
22 | return null; | ||
23 | } | ||
24 | |||
25 | @Override | ||
26 | public boolean isTerminated() { | ||
27 | return terminated; | ||
28 | } | ||
29 | |||
30 | @Override | ||
31 | public boolean move() { | ||
32 | terminated = true; | ||
33 | return false; | ||
34 | } | ||
35 | } | ||
36 | } | ||