From 1a39aad59a9e062f88c38db3571c93194a2cc0f6 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Thu, 17 Oct 2024 10:53:11 +0200 Subject: [PATCH] feat: Add a list utils extension --- .../common/utils/ListExt.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ListExt.kt diff --git a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ListExt.kt b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ListExt.kt new file mode 100644 index 00000000..faa3c961 --- /dev/null +++ b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ListExt.kt @@ -0,0 +1,22 @@ +/* + * Infomaniak SwissTransfer - Multiplatform + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.infomaniak.multiplatform_swisstransfer.common.utils + +inline fun Iterable.mapToList(transform: (T) -> R): List { + return mapTo(mutableListOf(), transform) +}