@Test public void testCompareMixedFormat() { MSIStreamName name1 = new MSIStreamName("@_X"); MSIStreamName name2 = new MSIStreamName("\u4840\u3F7F\u4164\u422F\u4836"); assertTrue(name1.compareTo(name2) < 0); }
public int compareTo(MSIStreamName other) { byte[] a = this.nameUTF16; byte[] b = other.nameUTF16; int size = Math.min(a.length, b.length); for (int i = 0; i < size; i++) { if (a[i] != b[i]) { return (a[i] & 0xFF) - (b[i] & 0xFF); } } return a.length - b.length; }
MSIStreamName implements Comparable<MSIStreamName> { public int compareTo(MSIStreamName other) { byte[] a = this.nameUTF16; byte[] b = other.nameUTF16; int size = Math.min(a.length, b.length); for (int i = 0; i < size; i++) { if (a[i] != b[i]) { return (a[i] & 0xFF) - (b[i] & 0xFF); } } return a.length - b.length; } }
MSIStreamName implements Comparable<MSIStreamName> { public int compareTo(MSIStreamName other) { byte[] a = this.nameUTF16; byte[] b = other.nameUTF16; int size = Math.min(a.length, b.length); for (int i = 0; i < size; i++) { if (a[i] != b[i]) { return (a[i] & 0xFF) - (b[i] & 0xFF); } } return a.length - b.length; } MSIStreamName(String name); }
MSIStreamName implements Comparable<MSIStreamName> { public int compareTo(MSIStreamName other) { byte[] a = this.nameUTF16; byte[] b = other.nameUTF16; int size = Math.min(a.length, b.length); for (int i = 0; i < size; i++) { if (a[i] != b[i]) { return (a[i] & 0xFF) - (b[i] & 0xFF); } } return a.length - b.length; } MSIStreamName(String name); String decode(); String toString(); int compareTo(MSIStreamName other); }
MSIStreamName implements Comparable<MSIStreamName> { public int compareTo(MSIStreamName other) { byte[] a = this.nameUTF16; byte[] b = other.nameUTF16; int size = Math.min(a.length, b.length); for (int i = 0; i < size; i++) { if (a[i] != b[i]) { return (a[i] & 0xFF) - (b[i] & 0xFF); } } return a.length - b.length; } MSIStreamName(String name); String decode(); String toString(); int compareTo(MSIStreamName other);  }