Extension suggestion: Array<T>.contains


#1

There doesn't seem to be a 'contains' method on Array. It would seem to be a sensible method to have as there is a similar method for List.

You can of course use

array.count { it == item } != 0

But it is kind of awkward. Therefore a contains method would be useful:

fun <T> Array<T>.contains(item: T): Boolean {   for (a in this) {   if (a == item) {            return true   }   }   return false }


#2

array.any { it == item }

#3

true enough, although contains still seems good since List and ArrayList has it :-)


#4

Feel free to file a request into the issue tracker