Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
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.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/**
* 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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(collectionSizeOrDefault(10))
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(size())
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 = ArrayList(collectionSizeOrDefault(10))
while (first.hasNext() && second.hasNext()) {
list.add(transform(first.next(), second.next()))
}
return list
}
/**
* Returns a sequence of values built from elements of both collections with same indexes using provided *transform*. Resulting sequence has length of shortest input sequences.
*/
public fun Sequence.merge(sequence: Sequence, transform: (T, R) -> V): Sequence {
return MergingSequence(this, sequence, transform)
}
deprecated("Migrate to using Sequence and respective functions")
/**
* Returns a stream of values built from elements of both collections with same indexes using provided *transform*. Resulting stream has length of shortest input streams.
*/
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 Sequence.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)
}
deprecated("Migrate to using Sequence and respective functions")
/**
* 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 sequence containing all elements of original sequence and then all elements of the given [collection]
*/
public fun Sequence.plus(collection: Iterable): Sequence {
return MultiSequence(sequenceOf(this, collection.sequence()))
}
deprecated("Migrate to using Sequence and respective functions")
/**
* 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 sequence containing all elements of original sequence and then the given element
*/
public fun Sequence.plus(element: T): Sequence {
return MultiSequence(sequenceOf(this, sequenceOf(element)))
}
deprecated("Migrate to using Sequence and respective functions")
/**
* 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 sequence containing all elements of original sequence and then all elements of the given [sequence]
*/
public fun Sequence.plus(sequence: Sequence): Sequence {
return MultiSequence(sequenceOf(this, sequence))
}
deprecated("Migrate to using Sequence and respective functions")
/**
* 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