Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a43b6c3 authored by Shai Barack's avatar Shai Barack
Browse files

compareMessages should check instance equality first

If the two instances are equal, return 0 (Messages are equal).
This has no effect on correctness, it's just a minor performance shortcut.

Flag: EXEMPT minor cleanup
Change-Id: I57f4ce50c7ba1e39bc1c8d338381499dd8c01719
parent b91340c1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -551,6 +551,10 @@ public final class Message implements Parcelable {
    }

    /*package*/ static int compareMessages(@NonNull Message m1, @NonNull Message m2) {
        if (m1 == m2) {
            return 0;
        }

        // Primary queue order is by when.
        // Messages with an earlier when should come first in the queue.
        final long whenDiff = m1.when - m2.when;