Documentation / dataflow / com.femastudios.dataflow.util / DataflowCollectionUtils
Go to reference


object DataflowCollectionUtils

A utility class for dataflow collections



Clones the given map in a new MutableMap of the given expectedSize

fun <K, V> cloneMap(map: Map<out K, V>, expectedSize: Int = map.size, preserveOrder: Boolean = false): MutableMap<K, V>


Creates a map in the most efficient way possible. The caller should not make any assumptions on the type of map that is returned, outside the provided parameters. The current implementation can return a LinkedHashMap, Android's android.util.ArrayMap or androidx.collection.ArrayMap (if available) or a HashMap. The exact class instance returned by this method may be subject to change in the future.

fun <K, V> createMap(expectedSize: Int = -1, preserveOrder: Boolean = false): MutableMap<K, V>