MCPcopy Index your code
hub / github.com/antlr/codebuff / combineUnordered

Method combineUnordered

output/java_guava/1.4.17/Hashing.java:639–652  ·  view source on GitHub ↗

Returns a hash code, having the same bit length as each of the input hash codes, that combines the information of these hash codes in an unordered fashion. That is, whenever two equal hash codes are produced by two calls to this method, it is as likely as possible that each was computed from

(Iterable<HashCode> hashCodes)

Source from the content-addressed store, hash-verified

637
638
639 public static HashCode combineUnordered(Iterable<HashCode> hashCodes) {
640 Iterator<HashCode> iterator = hashCodes.iterator();
641 checkArgument(iterator.hasNext(), "Must be at least 1 hash code to combine.");
642
643 byte[] resultBytes = new byte[iterator.next().bits() / 8];
644 for (HashCode hashCode : hashCodes) {
645 byte[] nextBytes = hashCode.asBytes();
646 checkArgument(nextBytes.length == resultBytes.length, "All hashcodes must have the same bit length.");
647 for (int i = 0; i < nextBytes.length; i++) {
648 resultBytes[i] += nextBytes[i];
649 }
650 }
651 return HashCode.fromBytesNoCopy(resultBytes);
652 }
653
654 /**
655 * Checks that the passed argument is positive, and ceils it to a multiple of 32.

Callers

nothing calls this directly

Calls 7

fromBytesNoCopyMethod · 0.95
iteratorMethod · 0.65
bitsMethod · 0.65
nextMethod · 0.65
checkArgumentMethod · 0.45
hasNextMethod · 0.45
asBytesMethod · 0.45

Tested by

no test coverage detected