From 45b7e8777f0148350e4793a2c9dcb6dbfc488c92 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Tue, 30 Apr 2024 16:13:56 +0200 Subject: [PATCH] change: Use SAM with `sortWith` comparator --- core/ui/src/main/kotlin/com/twitter/twittertext/Extractor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ui/src/main/kotlin/com/twitter/twittertext/Extractor.kt b/core/ui/src/main/kotlin/com/twitter/twittertext/Extractor.kt index 70db0e907..7ba4ce767 100644 --- a/core/ui/src/main/kotlin/com/twitter/twittertext/Extractor.kt +++ b/core/ui/src/main/kotlin/com/twitter/twittertext/Extractor.kt @@ -36,7 +36,7 @@ open class Extractor { private fun removeOverlappingEntities(entities: MutableList) { // sort by index - entities.sortWith(Comparator { e1, e2 -> e1.start - e2.start }) + entities.sortWith { e1, e2 -> e1.start - e2.start } // Remove overlapping entities. // Two entities overlap only when one is URL and the other is hashtag/mention