Remove redundant toList() calls after sorted()

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
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()) } return stream.filter { Files.isDirectory(it) && ARCHIVE_NAME.matches(it.fileName.toString()) }
.map { Integer.parseInt(it.fileName.toString()) } .map { Integer.parseInt(it.fileName.toString()) }
.sorted() .sorted()
.toList()
} }
} }
@ -61,7 +60,6 @@ public class FlatFileStore private constructor(
return stream.filter { Files.isRegularFile(it) && GROUP_NAME.matches(it.fileName.toString()) } return stream.filter { Files.isRegularFile(it) && GROUP_NAME.matches(it.fileName.toString()) }
.map { Integer.parseInt(it.fileName.toString().removeSuffix(GROUP_EXTENSION)) } .map { Integer.parseInt(it.fileName.toString().removeSuffix(GROUP_EXTENSION)) }
.sorted() .sorted()
.toList()
} }
} }

@ -45,11 +45,11 @@ public fun Path.recursiveEquals(
filter: (Path) -> Boolean = { true } filter: (Path) -> Boolean = { true }
): Boolean { ): Boolean {
val list1 = Files.newDirectoryStream(this).use { stream -> 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 -> 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) { if (list1 != list2) {

Loading…
Cancel
Save