From 0b43e26d36de9f48a185dbbdd5f253db1337f949 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 13 Dec 2020 14:28:44 +0000 Subject: [PATCH] Remove redundant toList() calls after sorted() Signed-off-by: Graham --- cache/src/main/kotlin/org/openrs2/cache/FlatFileStore.kt | 2 -- util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cache/src/main/kotlin/org/openrs2/cache/FlatFileStore.kt b/cache/src/main/kotlin/org/openrs2/cache/FlatFileStore.kt index 072eb906fe..fd184b4669 100644 --- a/cache/src/main/kotlin/org/openrs2/cache/FlatFileStore.kt +++ b/cache/src/main/kotlin/org/openrs2/cache/FlatFileStore.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() } } diff --git a/util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt b/util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt index 26d77d11de..7036808b49 100644 --- a/util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt +++ b/util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt @@ -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) {