File tree Expand file tree Collapse file tree 2 files changed +2
-16
lines changed
firebase-firestore/src/main/java/com/google/firebase/firestore Expand file tree Collapse file tree 2 files changed +2
-16
lines changed Original file line number Diff line number Diff line change 15
15
package com .google .firebase .firestore .index ;
16
16
17
17
import static com .google .firebase .firestore .util .Util .compareByteArrays ;
18
- import static com .google .firebase .firestore .util .Util .nullSafeCompare ;
19
18
20
19
import com .google .auto .value .AutoValue ;
21
20
import com .google .firebase .firestore .model .DocumentKey ;
22
- import com .google .firebase .firestore .util .Util ;
23
21
24
22
/** Represents an index entry saved by the SDK in its local storage. */
25
23
@ AutoValue
@@ -48,9 +46,9 @@ public int compareTo(IndexEntry other) {
48
46
cmp = getDocumentKey ().compareTo (other .getDocumentKey ());
49
47
if (cmp != 0 ) return cmp ;
50
48
51
- cmp = compareByteArrays (getDirectionalValue (), other .getDirectionalValue ());
49
+ cmp = compareByteArrays (getArrayValue (), other .getArrayValue ());
52
50
if (cmp != 0 ) return cmp ;
53
51
54
- return nullSafeCompare ( getArrayValue (), other .getArrayValue (), Util :: compareByteArrays );
52
+ return compareByteArrays ( getDirectionalValue (), other .getDirectionalValue () );
55
53
}
56
54
}
Original file line number Diff line number Diff line change @@ -214,18 +214,6 @@ public static void crashMainThread(RuntimeException exception) {
214
214
});
215
215
}
216
216
217
- public static <T > int nullSafeCompare (
218
- @ Nullable T left , @ Nullable T right , Comparator <T > comparator ) {
219
- if (left != null && right != null ) {
220
- return comparator .compare (left , right );
221
- }
222
- return left == null ? (right == null ? 0 : -1 ) : 1 ;
223
- }
224
-
225
- public static <T extends Comparable <T >> int nullSafeCompare (@ Nullable T left , @ Nullable T right ) {
226
- return nullSafeCompare (left , right , Comparable ::compareTo );
227
- }
228
-
229
217
public static int compareByteArrays (byte [] left , byte [] right ) {
230
218
int size = Math .min (left .length , right .length );
231
219
for (int i = 0 ; i < size ; i ++) {
You can’t perform that action at this time.
0 commit comments