KT-923 Collection.indices property

This commit is contained in:
Alex Tkachman
2012-01-08 13:24:14 +02:00
parent 33f145a83a
commit 897f3dc799
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -19,6 +19,8 @@ inline fun linkedList<T>(vararg values: T) : LinkedList<T> = values.to(LinkedLi
/** Returns a new HashSet with a variable number of initial elements */
inline fun hashSet<T>(vararg values: T) : HashSet<T> = values.to(HashSet<T>(values.size))
val Collection<*>.indices : IntRange
get() = 0..size-1
inline fun <T> java.util.Collection<T>.toArray() : Array<T> {
val answer = Array<T>(this.size)