Files
kotlin-fork/libraries/stdlib/src/generated/BooleanArraysFromJLangIterablesLazy.kt
T
2012-09-05 18:55:16 +04:00

120 lines
3.8 KiB
Kotlin

package kotlin
//
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
// Generated from input file: JLangIterablesLazy.kt
//
import java.util.ArrayList
//
// This file contains methods which could have a lazy implementation for things like
// Iterator<Boolean> or java.util.Iterator<Boolean>
//
// See [[GenerateStandardLib.kt]] for more details
//
/**
* Returns a list containing all elements which match the given *predicate*
*
* @includeFunctionBody ../../test/CollectionTest.kt filter
*/
public inline fun BooleanArray.filter(predicate: (Boolean) -> Boolean) : List<Boolean> = filterTo(ArrayList<Boolean>(), predicate)
/**
* Returns a list containing all elements which do not match the given predicate
*
* @includeFunctionBody ../../test/CollectionTest.kt filterNot
*/
public inline fun BooleanArray.filterNot(predicate: (Boolean)-> Boolean) : List<Boolean> = filterNotTo(ArrayList<Boolean>(), predicate)
/**
* Returns a list containing all the non-*null* elements
*
* @includeFunctionBody ../../test/CollectionTest.kt filterNotNull
*/
public inline fun BooleanArray?.filterNotNull() : List<Boolean> = filterNotNullTo<ArrayList<Boolean>>(java.util.ArrayList<Boolean>())
/**
* Returns the result of transforming each element to one or more values which are concatenated together into a single collection
*
* @includeFunctionBody ../../test/CollectionTest.kt flatMap
*/
public inline fun <R> BooleanArray.flatMap(transform: (Boolean)-> Collection<R>) : Collection<R> = flatMapTo(ArrayList<R>(), transform)
/**
* Creates a copy of this collection as a [[List]] with the element added at the end
*
* @includeFunctionBody ../../test/CollectionTest.kt plus
*/
public inline fun BooleanArray.plus(element: Boolean): List<Boolean> {
val list = toCollection(ArrayList<Boolean>())
list.add(element)
return list
}
/**
* Creates a copy of this collection as a [[List]] with all the elements added at the end
*
* @includeFunctionBody ../../test/CollectionTest.kt plusCollection
*/
public inline fun BooleanArray.plus(elements: BooleanArray): List<Boolean> {
val list = toCollection(ArrayList<Boolean>())
list.addAll(elements.toCollection())
return list
}
/**
* Returns a list containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
*
* @includeFunctionBody ../../test/CollectionTest.kt requireNoNulls
*/
public inline fun BooleanArray.requireNoNulls() : List<Boolean> {
val list = ArrayList<Boolean>()
for (element in this) {
if (element == null) {
throw IllegalArgumentException("null element found in $this")
} else {
list.add(element)
}
}
return list
}
/**
* Returns a list containing everything but the first *n* elements
*
* @includeFunctionBody ../../test/CollectionTest.kt drop
*/
public inline fun BooleanArray.drop(n: Int): List<Boolean> {
return dropWhile(countTo(n))
}
/**
* Returns a list containing the everything but the first elements that satisfy the given *predicate*
*
* @includeFunctionBody ../../test/CollectionTest.kt dropWhile
*/
public inline fun BooleanArray.dropWhile(predicate: (Boolean) -> Boolean): List<Boolean> = dropWhileTo(ArrayList<Boolean>(), predicate)
/**
* Returns a list containing the first *n* elements
*
* @includeFunctionBody ../../test/CollectionTest.kt take
*/
public inline fun BooleanArray.take(n: Int): List<Boolean> {
return takeWhile(countTo(n))
}
/**
* Returns a list containing the first elements that satisfy the given *predicate*
*
* @includeFunctionBody ../../test/CollectionTest.kt takeWhile
*/
public inline fun BooleanArray.takeWhile(predicate: (Boolean) -> Boolean): List<Boolean> = takeWhileTo(ArrayList<Boolean>(), predicate)