Documentation / dataflow / com.femastudios.dataflow.extensions / addIfNotContains
Go to reference

addIfNotContains

fun <T> MutableField<Collection<T>>.addIfNotContains(element: T): Boolean

Adds the given element to the collection if not already present. The operation is atomic and thread-safe.

Return
true if the element has been added, false if the element is already contained in the collection.


fun <T> MutableField<List<T>>.addIfNotContains(element: T): Boolean

Adds the given element to the collection if not already present. The operation is atomic and thread-safe.

Return
true if the element has been added, false if the element is already contained in the list.