From 581f337198e5ac85045ba375541a493034f94d80 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sat, 25 Mar 2023 20:51:29 +0700 Subject: [PATCH] Don't use Streams.concat because they don't improve performance here --- src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt | 8 ++++---- .../ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt index 2192faf38..a404652a6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt @@ -209,7 +209,7 @@ fun ICapabilityProvider.getMatteryEnergySided(side: Direction? = null): LazyOpti * Contains all items that player might carry */ fun Player.itemsStream(includeCosmetics: Boolean = true): Stream { - val streams = LinkedList>() + val streams = ArrayList>() streams.add(inventory.stream()) matteryPlayer?.let { @@ -226,7 +226,7 @@ fun Player.itemsStream(includeCosmetics: Boolean = true): Stream streams.add(cosmeticArmorStream()) } - return Streams.concat(*streams.toTypedArray()) + return streams.stream().flatMap { it } } /** @@ -256,7 +256,7 @@ fun Player.allItemsStream(includeCosmetics: Boolean = true): Stream { - val streams = LinkedList>() + val streams = ArrayList>() streams.add(inventory.awareStream()) matteryPlayer?.let { @@ -273,7 +273,7 @@ fun Player.awareItemsStream(includeCosmetics: Boolean = false): Stream {