Use Collections.sort() to satisfy Animal Sniffer.

This commit is contained in:
akwizgran
2020-12-04 12:16:58 +00:00
parent aff649cb06
commit 45c205e4ba

View File

@@ -22,6 +22,7 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import static java.util.Collections.emptyList; import static java.util.Collections.emptyList;
import static java.util.Collections.sort;
import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.MIN_AUTO_DELETE_TIMER_MS; import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.MIN_AUTO_DELETE_TIMER_MS;
import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.NO_AUTO_DELETE_TIMER; import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.NO_AUTO_DELETE_TIMER;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@@ -229,11 +230,11 @@ public class AutoDeleteIntegrationTest
txn -> autoDeleteManager.getAutoDeleteTimer(txn, contactId)); txn -> autoDeleteManager.getAutoDeleteTimer(txn, contactId));
} }
@SuppressWarnings({"UseCompareMethod", "Java8ListSort"}) // Animal Sniffer
private List<ConversationMessageHeader> sortHeaders( private List<ConversationMessageHeader> sortHeaders(
Collection<ConversationMessageHeader> in) { Collection<ConversationMessageHeader> in) {
List<ConversationMessageHeader> out = new ArrayList<>(in); List<ConversationMessageHeader> out = new ArrayList<>(in);
//noinspection UseCompareMethod sort(out, (a, b) ->
out.sort((a, b) ->
Long.valueOf(a.getTimestamp()).compareTo(b.getTimestamp())); Long.valueOf(a.getTimestamp()).compareTo(b.getTimestamp()));
return out; return out;
} }