@Override public int compareTo(Object o) {
            Pair pair = (Pair) o;
            int d = this.value - pair.value;
            if (d != 0)
                return d;
            return this.index - pair.index;
        }
Why Did you create this class? what does it do?
src/problems/medium/DailyTemperature.java