mirror of
https://github.com/tiennm99/tjahzi.git
synced 2026-10-14 06:18:06 +00:00
Re #48: Rewrote to not use Java 9 method.
This commit is contained in:
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;
|
||||
|
||||
Reference in new issue
Block a user