Refactoring datastore package
Preparation to make datastore replacable
- Extract datastore interfaces
- Add multi Read/Write/Remove
- Add a method to walk over RCTable
- Refactor serialize/deserialize RCObject
- Localize dependency to JRAMCloud
- Separate RAMCloud specific code into ramcloud package
- Remove dependency to RAMCloud exception classes
- Remove RC prefix from non RAMCloud specific code
- Cosmetics and update sample/test code
- reflect Naoki's comment
- more cosmetic fixes
- reordered OPERATION enums
- removed no longer used code
- follow pmd, etc. where easily possible
Change-Id: I6f9153d705600447acf48a64f713c654c9f26713
diff --git a/src/main/java/net/onrc/onos/datastore/utils/ByteArrayComparator.java b/src/main/java/net/onrc/onos/datastore/utils/ByteArrayComparator.java
index 08290a3..56b088f 100644
--- a/src/main/java/net/onrc/onos/datastore/utils/ByteArrayComparator.java
+++ b/src/main/java/net/onrc/onos/datastore/utils/ByteArrayComparator.java
@@ -3,12 +3,20 @@
import java.nio.ByteBuffer;
import java.util.Comparator;
+/**
+ * Comparator which will compares the content of byte[].
+ *
+ * Expected to be used with TreeMap, etc. when you want to use byte[] as a key.
+ */
public final class ByteArrayComparator implements Comparator<byte[]> {
+ /**
+ * Instance which can be used, if you want to avoid instantiation per Map.
+ */
public static final ByteArrayComparator BYTEARRAY_COMPARATOR = new ByteArrayComparator();
@Override
- public int compare(byte[] o1, byte[] o2) {
+ public int compare(final byte[] o1, final byte[] o2) {
final ByteBuffer b1 = ByteBuffer.wrap(o1);
final ByteBuffer b2 = ByteBuffer.wrap(o2);
return b1.compareTo(b2);