package kotlin // // NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib // import java.util.* /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun Array.merge(array: Array, transform: (T, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun BooleanArray.merge(array: Array, transform: (Boolean, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun ByteArray.merge(array: Array, transform: (Byte, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun CharArray.merge(array: Array, transform: (Char, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun DoubleArray.merge(array: Array, transform: (Double, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun FloatArray.merge(array: Array, transform: (Float, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun IntArray.merge(array: Array, transform: (Int, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun LongArray.merge(array: Array, transform: (Long, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun ShortArray.merge(array: Array, transform: (Short, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun Iterable.merge(array: Array, transform: (T, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun String.merge(array: Array, transform: (Char, R) -> V): List { val first = iterator() val second = array.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun Array.merge(other: Iterable, transform: (T, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun BooleanArray.merge(other: Iterable, transform: (Boolean, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun ByteArray.merge(other: Iterable, transform: (Byte, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun CharArray.merge(other: Iterable, transform: (Char, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun DoubleArray.merge(other: Iterable, transform: (Double, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun FloatArray.merge(other: Iterable, transform: (Float, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun IntArray.merge(other: Iterable, transform: (Int, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun LongArray.merge(other: Iterable, transform: (Long, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun ShortArray.merge(other: Iterable, transform: (Short, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun Iterable.merge(other: Iterable, transform: (T, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. */ public inline fun String.merge(other: Iterable, transform: (Char, R) -> V): List { val first = iterator() val second = other.iterator() val list = arrayListOf() while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list } /** * Returns a stream of values built from elements of both collections with same indexes using provided *transform*. Stream has length of shortest stream. */ public fun Stream.merge(stream: Stream, transform: (T, R) -> V): Stream { return MergingStream(this, stream, transform) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun Array.partition(predicate: (T) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun BooleanArray.partition(predicate: (Boolean) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun ByteArray.partition(predicate: (Byte) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun CharArray.partition(predicate: (Char) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun DoubleArray.partition(predicate: (Double) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun FloatArray.partition(predicate: (Float) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun IntArray.partition(predicate: (Int) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun LongArray.partition(predicate: (Long) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun ShortArray.partition(predicate: (Short) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun Iterable.partition(predicate: (T) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun Stream.partition(predicate: (T) -> Boolean): Pair, List> { val first = ArrayList() val second = ArrayList() for (element in this) { if (predicate(element)) { first.add(element) } else { second.add(element) } } return Pair(first, second) } /** * Splits original collection into pair of collections, * where *first* collection contains elements for which predicate yielded *true*, * while *second* collection contains elements for which predicate yielded *false* */ public inline fun String.partition(predicate: (Char) -> Boolean): Pair { val first = StringBuilder() val second = StringBuilder() for (element in this) { if (predicate(element)) { first.append(element) } else { second.append(element) } } return Pair(first.toString(), second.toString()) } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun Array.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun BooleanArray.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun ByteArray.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun CharArray.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun DoubleArray.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun FloatArray.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun IntArray.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun LongArray.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun ShortArray.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun Iterable.plus(array: Array): List { val answer = toArrayList() answer.addAll(array) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun Array.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun BooleanArray.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun ByteArray.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun CharArray.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun DoubleArray.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun FloatArray.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun IntArray.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun LongArray.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun ShortArray.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a list containing all elements of original collection and then all elements of the given *collection* */ public fun Iterable.plus(collection: Iterable): List { val answer = toArrayList() answer.addAll(collection) return answer } /** * Returns a stream containing all elements of original stream and then all elements of the given *collection* */ public fun Stream.plus(collection: Iterable): Stream { return Multistream(streamOf(this, collection.stream())) } /** * Returns a list containing all elements of original collection and then the given element */ public fun Array.plus(element: T): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun BooleanArray.plus(element: Boolean): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun ByteArray.plus(element: Byte): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun CharArray.plus(element: Char): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun DoubleArray.plus(element: Double): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun FloatArray.plus(element: Float): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun IntArray.plus(element: Int): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun LongArray.plus(element: Long): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun ShortArray.plus(element: Short): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a list containing all elements of original collection and then the given element */ public fun Iterable.plus(element: T): List { val answer = toArrayList() answer.add(element) return answer } /** * Returns a stream containing all elements of original stream and then the given element */ public fun Stream.plus(element: T): Stream { return Multistream(streamOf(this, streamOf(element))) } /** * Returns a stream containing all elements of original stream and then all elements of the given *stream* */ public fun Stream.plus(stream: Stream): Stream { return Multistream(streamOf(this, stream)) } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun Array.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun BooleanArray.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun ByteArray.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun CharArray.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun DoubleArray.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun FloatArray.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun IntArray.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun LongArray.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun ShortArray.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun Iterable.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun String.zip(array: Array): List> { return merge(array) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun Array.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun BooleanArray.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun ByteArray.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun CharArray.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun DoubleArray.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun FloatArray.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun IntArray.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun LongArray.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun ShortArray.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun Iterable.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. */ public fun String.zip(other: Iterable): List> { return merge(other) { (t1, t2) -> t1 to t2 } } /** * Returns a list of pairs built from characters of both strings with same indexes. List has length of shortest collection. */ public fun String.zip(other: String): List> { val first = iterator() val second = other.iterator() val list = ArrayList>() while (first.hasNext() && second.hasNext()) { list.add(first.next() to second.next()) } return list } /** * Returns a stream of pairs built from elements of both collections with same indexes. Stream has length of shortest stream. */ public fun Stream.zip(stream: Stream): Stream> { return MergingStream(this, stream) { (t1, t2) -> t1 to t2 } }