pluralString

fun <E> Collection<E>.pluralString(empty: () -> String, single: (E) -> String, moreThanOne: (Iterable<E>) -> String): String(source)

Returns a string representation of the collection based on its size.

Return

A string representation of the collection.

Parameters

empty

A function that generates a string for when the collection is empty.

single

A function that generates a string for when the collection contains a single element. The single element is passed as an argument to this function.

moreThanOne

A function that generates a string for when the collection contains more than one element. The entire collection is passed as an argument to this function.