You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/01/09 23:22:01 UTC

[GitHub] [zookeeper] eolivelli commented on a change in pull request #1213: ZOOKEEPER-3685: Use JDK Arrays Equals for Jute

eolivelli commented on a change in pull request #1213: ZOOKEEPER-3685: Use JDK Arrays Equals for Jute
URL: https://github.com/apache/zookeeper/pull/1213#discussion_r365007971
 
 

 ##########
 File path: zookeeper-jute/src/main/java/org/apache/jute/Utils.java
 ##########
 @@ -30,32 +30,6 @@ private Utils() {
         super();
     }
 
-    /**
-     * equals function that actually compares two buffers.
-     *
-     * @param onearray First buffer
-     * @param twoarray Second buffer
-     * @return true if one and two contain exactly the same content, else false.
-     */
-    public static boolean bufEquals(byte[] onearray, byte[] twoarray) {
-        if (onearray == twoarray) {
-            return true;
-        }
-
-        boolean ret = (onearray.length == twoarray.length);
-
-        if (!ret) {
-            return ret;
-        }
-
-        for (int idx = 0; idx < onearray.length; idx++) {
-            if (onearray[idx] != twoarray[idx]) {
-                return false;
-            }
-        }
-        return true;
-    }
-
     public static int compareBytes(byte[] b1, int off1, int len1, byte[] b2, int off2, int len2) {
 
 Review comment:
   Do you want to try to use Arrays.compare introduced in JDK9, in is another hotspot intrinsic ? 
   We should go for a multi release jar
   I have done it in this project
   https://github.com/diennea/herddb/blob/master/herddb-utils/src/main/java10/herddb/utils/CompareBytesUtils.java
   
   It is just a suggestion, I see you like this kind of stuff, the same for me :-)  

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


With regards,
Apache Git Services