asfgit closed pull request #313: ACCUMULO-4726 Add Value.contentEquals(byte[]) 
method
URL: https://github.com/apache/accumulo/pull/313
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/java/org/apache/accumulo/core/data/Value.java 
b/core/src/main/java/org/apache/accumulo/core/data/Value.java
index 95c3c70dbc..d847334a24 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Value.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Value.java
@@ -242,16 +242,22 @@ public int compareTo(final byte[] that) {
 
   @Override
   public boolean equals(Object right_obj) {
-    // compare with byte[] for backwards compatibility, but this is generally 
a pretty bad practice
-    if (right_obj instanceof byte[]) {
-      return compareTo((byte[]) right_obj) == 0;
-    }
     if (right_obj instanceof Value) {
       return compareTo(right_obj) == 0;
     }
     return false;
   }
 
+  /**
+   * Compares the bytes in this object to the specified byte array
+   *
+   * @return true if the contents of this Value is equivalent to the supplied 
byte array
+   * @since 2.0.0
+   */
+  public boolean contentEquals(byte[] right_obj) {
+    return compareTo(right_obj) == 0;
+  }
+
   @Override
   public String toString() {
     return new String(get(), UTF_8);
diff --git 
a/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java
 
b/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java
index adf8959564..a610117126 100644
--- 
a/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java
+++ 
b/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java
@@ -303,7 +303,7 @@ public void test_maxLongInclusiveKey() throws IOException {
     it.seek(testRange, EMPTY_COL_FAMS, false);
 
     assertTrue(it.hasTop());
-    assertTrue(it.getTopValue().equals("00".getBytes()));
+    assertTrue(it.getTopValue().contentEquals("00".getBytes()));
     it.next();
     assertFalse(it.hasTop());
   }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to