HorayNarea / MozStumbler

Android Stumbler for Mozilla
http://location.services.mozilla.com
Mozilla Public License 2.0
0 stars 0 forks source link

replace Guava with 12 lines of code #1

Closed HorayNarea closed 1 year ago

HorayNarea commented 1 year ago

https://github.com/HorayNarea/MozStumbler/blob/d7223313cad79f655cecd03282eefbbb022af054/libraries/stumbler/src/main/java/org/mozilla/mozstumbler/service/core/offline/LocationService.java#L12

replace with the following function to get rid of Guava

private static int maxIntInArray(int... array) {
    if (!(array.length > 0)) {
        throw new IllegalArgumentException();
    }
    int max = array[0];
    for (int i = 1; i < array.length; i++) {
        if (array[i] > max) {
            max = array[i];
        }
    }
    return max;
}

It's only used in https://github.com/HorayNarea/MozStumbler/blob/d7223313cad79f655cecd03282eefbbb022af054/libraries/stumbler/src/main/java/org/mozilla/mozstumbler/service/core/offline/LocationService.java#L114 https://github.com/HorayNarea/MozStumbler/blob/d7223313cad79f655cecd03282eefbbb022af054/libraries/stumbler/src/main/java/org/mozilla/mozstumbler/service/core/offline/LocationService.java#L159