From f7af06f344e335ccabc296b4233a02275e9d8e26 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Tue, 7 Oct 2025 15:18:20 +0200 Subject: [PATCH] [fleet, util] drop grouping util methods GitOrigin-RevId: bffaa59d0f91ca8681806090cd79d6c18ada6b7a --- .../core/srcCommonMain/fleet/util/List.kt | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 fleet/util/core/srcCommonMain/fleet/util/List.kt diff --git a/fleet/util/core/srcCommonMain/fleet/util/List.kt b/fleet/util/core/srcCommonMain/fleet/util/List.kt deleted file mode 100644 index 162b9246eac4..000000000000 --- a/fleet/util/core/srcCommonMain/fleet/util/List.kt +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package fleet.util - -fun Iterable>.union(): Set = flatMapTo(mutableSetOf()) { it } - -//@fleet.kernel.plugins.InternalInPluginModules(where = ["fleet.util.test"]) -fun MutableList.updateGrouping( - beforeGroup: MutableList.(isOpening: Boolean) -> Unit = {}, - afterGroup: MutableList.(isClosing: Boolean) -> Unit = {}, - body: MutableList.(newGroup: () -> Unit) -> Unit, -) { - beforeGroup(true) - var count = size - var lastGroupEnd = size - body { - if (count < size) { - afterGroup(false) - lastGroupEnd = size - beforeGroup(false) - count = size - } - } - if (count == size) - while (size > lastGroupEnd) { removeLast() } - afterGroup(true) -} - -fun MutableList.updateSeparating( - separator: MutableList.() -> Unit = {}, - body: MutableList.(newGroup: () -> Unit) -> Unit, -) = updateGrouping( - beforeGroup = { isOpening -> if (!isOpening) separator() }, -) { newGroup -> - newGroup() - body(newGroup) -} \ No newline at end of file