mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-13 11:36:15 +01:00
BlockLocator: functional-style hashCode()
calculation
Use mapToInt/reduce.
This commit is contained in:
parent
e34dd300ec
commit
690f5149c0
1 changed files with 3 additions and 5 deletions
|
@ -98,11 +98,9 @@ public final class BlockLocator {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 0;
|
||||
for (Sha256Hash i : hashes) {
|
||||
hashCode ^= i.hashCode();
|
||||
}
|
||||
return hashCode;
|
||||
return hashes.stream()
|
||||
.mapToInt(Sha256Hash::hashCode)
|
||||
.reduce(0, (a, b) -> a ^ b);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue