Package com.tomtom.sdk.common.collections

Functions

Link copied to clipboard
fun <E : Any> MutableCollection<E>.addOrThrow(element: E, lazyMessage: () -> Any = { "Element has already been added" })

Adds element to MutableCollection if it does not contain it yet. Throws an IllegalArgumentException with the result of calling lazyMessage if the collections already contains the element.

Link copied to clipboard
fun <T> List<T>.binaryFindFirst(predicate: (T) -> Boolean): T?

Important: This is a Public Preview API. It may be changed or removed at any time.

Link copied to clipboard
fun <T> List<T>.binaryFindLast(predicate: (T) -> Boolean): T?

Important: This is a Public Preview API. It may be changed or removed at any time.

Link copied to clipboard
fun <E> Iterator<E>.forEachNext(action: (E) -> Unit)

This is an equivalent of java.util.Iterator.forEachRemaining, but is named differently to avoid the naming clash. The Java's implementation cannot be used due to the minimum API level restrictions.