mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ByteSequence: proper equals and hasCode
This commit is contained in:
@@ -60,7 +60,7 @@ public class ByteSequence {
|
||||
|
||||
final byte[] thisBytes = myBytes;
|
||||
final byte[] thatBytes = sequence.myBytes;
|
||||
for (int i = 0, j = myOffset, k = sequence.myOffset; i < len; i++) {
|
||||
for (int i = 0, j = myOffset, k = sequence.myOffset; i < len; i++, j++, k++) {
|
||||
if (thisBytes[j] != thatBytes[k]) {
|
||||
return false;
|
||||
}
|
||||
@@ -75,8 +75,8 @@ public class ByteSequence {
|
||||
final byte[] thisBytes = myBytes;
|
||||
|
||||
int result = 1;
|
||||
for (int i = 0, j = myOffset; i < len; i++) {
|
||||
result = result * 31 + thisBytes[j];
|
||||
for (int i = myOffset; i < myOffset + len; i++) {
|
||||
result = result * 31 + thisBytes[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user