Re #48: Rewrote to not use Java 9 method.

This commit is contained in:
tomasz.kowalczewski committed 2021-06-13 23:11:31 +02:00
1 parent b258c29830
commit 88688197cd
1 file changed
+11 -4
@@ -3,8 +3,6 @@ package pl.tkowalcz.tjahzi;
import org.agrona.DirectBuffer;
import org.agrona.ExpandableArrayBuffer;
import java.util.Arrays;
public class LabelSerializer {
private final ExpandableArrayBuffer buffer = new ExpandableArrayBuffer();
@@ -45,11 +43,20 @@ public class LabelSerializer {
if (o instanceof LabelSerializer) {
LabelSerializer that = (LabelSerializer) o;
if (this.cursor != that.cursor) {
return false;
}
byte[] thisArray = this.buffer.byteArray();
byte[] thatArray = that.buffer.byteArray();
return this.cursor == that.cursor &&
Arrays.equals(thisArray, 0, cursor, thatArray, 0, cursor);
for (int i = 0; i < cursor; i++) {
if (thisArray[i] != thatArray[i]) {
return false;
}
}
return true;
}
return false;