Remove redundant toList() calls after sorted()

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 0ebe85ae39
commit 0b43e26d36
  1. 2
      cache/src/main/kotlin/org/openrs2/cache/FlatFileStore.kt
  2. 4
      util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt

@ -47,7 +47,6 @@ public class FlatFileStore private constructor(
return stream.filter { Files.isDirectory(it) && ARCHIVE_NAME.matches(it.fileName.toString()) }
.map { Integer.parseInt(it.fileName.toString()) }
.sorted()
.toList()
}
}
@ -61,7 +60,6 @@ public class FlatFileStore private constructor(
return stream.filter { Files.isRegularFile(it) && GROUP_NAME.matches(it.fileName.toString()) }
.map { Integer.parseInt(it.fileName.toString().removeSuffix(GROUP_EXTENSION)) }
.sorted()
.toList()
}
}

@ -45,11 +45,11 @@ public fun Path.recursiveEquals(
filter: (Path) -> Boolean = { true }
): Boolean {
val list1 = Files.newDirectoryStream(this).use { stream ->
stream.filter(filter).map { this.relativize(it).toString() }.sorted().toList()
stream.filter(filter).map { this.relativize(it).toString() }.sorted()
}
val list2 = Files.newDirectoryStream(other).use { stream ->
stream.filter(filter).map { other.relativize(it).toString() }.sorted().toList()
stream.filter(filter).map { other.relativize(it).toString() }.sorted()
}
if (list1 != list2) {

Loading…
Cancel
Save