All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.paoapps.fifi.utils.CollectionUtils.kt Maven / Gradle / Ivy

Go to download

Kotlin Multiplatform Mobile framework for optimal code sharing between iOS and Android.

The newest version!
package com.paoapps.fifi.utils

 fun  Iterable.insertInBetween(item: T): List {
    val result = mutableListOf()
    forEach { element ->
        if (result.isNotEmpty()) {
            result.add(item)
        }
        result.add(element)
    }
    return result
}

fun  Set.toggle(item: T): Set = if (contains(item)) minus(item) else plus(item)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy