restore Android API level 14 compatibility (#9386)

pull/9388/head
Elliotte Rusty Harold 3 years ago committed by GitHub
parent d8ccfbf005
commit 864aa49c6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      java/core/src/main/java/com/google/protobuf/ByteString.java

@ -268,22 +268,19 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
ByteIterator latterBytes = latter.iterator();
while (formerBytes.hasNext() && latterBytes.hasNext()) {
// Note: This code was copied from com.google.common.primitives.UnsignedBytes#compare,
// as Guava libraries cannot be used in the {@code com.google.protobuf} package.
int result =
Integer.compare(toInt(formerBytes.nextByte()), toInt(latterBytes.nextByte()));
int result = Integer.valueOf(toInt(formerBytes.nextByte()))
.compareTo(toInt(latterBytes.nextByte()));
if (result != 0) {
return result;
}
}
return Integer.compare(former.size(), latter.size());
return Integer.valueOf(former.size()).compareTo(Integer.valueOf(latter.size()));
}
};
/**
* Returns a {@link Comparator} which compares {@link ByteString}-s lexicographically
* as sequences of unsigned bytes (i.e. values between 0 and 255, inclusive).
* as sequences of unsigned byte values between 0 and 255, inclusive.
*
* <p>For example, {@code (byte) -1} is considered to be greater than {@code (byte) 1} because it
* is interpreted as an unsigned value, {@code 255}:

Loading…
Cancel
Save