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 kotlin.platform.*
import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/**
* Returns an [ArrayList] of all elements.
*/
public fun Array.toArrayList(): ArrayList {
return this.asList().toArrayList()
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun BooleanArray.toArrayList(): ArrayList {
val list = ArrayList(size())
for (item in this) list.add(item)
return list
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun ByteArray.toArrayList(): ArrayList {
val list = ArrayList(size())
for (item in this) list.add(item)
return list
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun CharArray.toArrayList(): ArrayList {
val list = ArrayList(size())
for (item in this) list.add(item)
return list
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun DoubleArray.toArrayList(): ArrayList {
val list = ArrayList(size())
for (item in this) list.add(item)
return list
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun FloatArray.toArrayList(): ArrayList {
val list = ArrayList(size())
for (item in this) list.add(item)
return list
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun IntArray.toArrayList(): ArrayList {
val list = ArrayList(size())
for (item in this) list.add(item)
return list
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun LongArray.toArrayList(): ArrayList {
val list = ArrayList(size())
for (item in this) list.add(item)
return list
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun ShortArray.toArrayList(): ArrayList {
val list = ArrayList(size())
for (item in this) list.add(item)
return list
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun Collection.toArrayList(): ArrayList {
return ArrayList(this)
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun Iterable.toArrayList(): ArrayList {
if (this is Collection)
return this.toArrayList()
return toCollection(ArrayList())
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun Sequence.toArrayList(): ArrayList {
return toCollection(ArrayList())
}
/**
* Returns an [ArrayList] of all elements.
*/
public fun String.toArrayList(): ArrayList {
return toCollection(ArrayList(length()))
}
/**
* Appends all elements to the given [collection].
*/
public fun > Array.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > BooleanArray.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > ByteArray.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > CharArray.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > DoubleArray.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > FloatArray.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > IntArray.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > LongArray.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > ShortArray.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > Iterable.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > Sequence.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Appends all elements to the given [collection].
*/
public fun > String.toCollection(collection: C): C {
for (item in this) {
collection.add(item)
}
return collection
}
/**
* Returns a [HashSet] of all elements.
*/
public fun Array.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun BooleanArray.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun ByteArray.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun CharArray.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun DoubleArray.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun FloatArray.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun IntArray.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun LongArray.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun ShortArray.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(size())))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun Iterable.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(collectionSizeOrDefault(12))))
}
/**
* Returns a [HashSet] of all elements.
*/
public fun Sequence.toHashSet(): HashSet {
return toCollection(HashSet())
}
/**
* Returns a [HashSet] of all elements.
*/
public fun String.toHashSet(): HashSet {
return toCollection(HashSet(mapCapacity(length())))
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun Array.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun BooleanArray.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun ByteArray.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun CharArray.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun DoubleArray.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun FloatArray.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun IntArray.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun LongArray.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun ShortArray.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun Iterable.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun Sequence.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [LinkedList] containing all elements.
*/
public fun String.toLinkedList(): LinkedList {
return toCollection(LinkedList())
}
/**
* Returns a [List] containing all key-value pairs.
*/
public fun Map.toList(): List> {
val result = ArrayList>(size())
for (item in this)
result.add(item.key to item.value)
return result
}
/**
* Returns a [List] containing all elements.
*/
public fun Array.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun BooleanArray.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun ByteArray.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun CharArray.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun DoubleArray.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun FloatArray.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun IntArray.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun LongArray.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun ShortArray.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun Iterable.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun Sequence.toList(): List {
return this.toArrayList()
}
/**
* Returns a [List] containing all elements.
*/
public fun String.toList(): List {
return this.toArrayList()
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun Array.toMap(selector: (T) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun BooleanArray.toMap(selector: (Boolean) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun ByteArray.toMap(selector: (Byte) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun CharArray.toMap(selector: (Char) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun DoubleArray.toMap(selector: (Double) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun FloatArray.toMap(selector: (Float) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun IntArray.toMap(selector: (Int) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun LongArray.toMap(selector: (Long) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun ShortArray.toMap(selector: (Short) -> K): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun Iterable.toMap(selector: (T) -> K): Map {
val capacity = (collectionSizeOrDefault(10)/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun Sequence.toMap(selector: (T) -> K): Map {
val result = LinkedHashMap()
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values from the given collection indexed by [selector].
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun String.toMap(selector: (Char) -> K): Map {
val capacity = (length()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), element)
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun Array.toMap(selector: (T) -> K, transform: (T) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun BooleanArray.toMap(selector: (Boolean) -> K, transform: (Boolean) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun ByteArray.toMap(selector: (Byte) -> K, transform: (Byte) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun CharArray.toMap(selector: (Char) -> K, transform: (Char) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun DoubleArray.toMap(selector: (Double) -> K, transform: (Double) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun FloatArray.toMap(selector: (Float) -> K, transform: (Float) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun IntArray.toMap(selector: (Int) -> K, transform: (Int) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun LongArray.toMap(selector: (Long) -> K, transform: (Long) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun ShortArray.toMap(selector: (Short) -> K, transform: (Short) -> V): Map {
val capacity = (size()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun Iterable.toMap(selector: (T) -> K, transform: (T) -> V): Map {
val capacity = (collectionSizeOrDefault(10)/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun Sequence.toMap(selector: (T) -> K, transform: (T) -> V): Map {
val result = LinkedHashMap()
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns Map containing the values provided by [transform] and indexed by [selector] from the given collection.
* If any two elements would have the same key returned by [selector] the last one gets added to the map.
*/
public inline fun String.toMap(selector: (Char) -> K, transform: (Char) -> V): Map {
val capacity = (length()/.75f) + 1
val result = LinkedHashMap(Math.max(capacity.toInt(), 16))
for (element in this) {
result.put(selector(element), transform(element))
}
return result
}
/**
* Returns a [Set] of all elements.
*/
public fun Array.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun BooleanArray.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun ByteArray.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun CharArray.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun DoubleArray.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun FloatArray.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun IntArray.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun LongArray.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun ShortArray.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(size())))
}
/**
* Returns a [Set] of all elements.
*/
public fun Iterable.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(collectionSizeOrDefault(12))))
}
/**
* Returns a [Set] of all elements.
*/
public fun Sequence.toSet(): Set {
return toCollection(LinkedHashSet())
}
/**
* Returns a [Set] of all elements.
*/
public fun String.toSet(): Set {
return toCollection(LinkedHashSet(mapCapacity(length())))
}
/**
* Returns a [SortedSet] of all elements.
*/
public fun Array.toSortedSet(): SortedSet {
return toCollection(TreeSet())
}
/**
* Returns a [SortedSet] of all elements.
*/
public fun BooleanArray.toSortedSet(): SortedSet {
return toCollection(TreeSet())
}
/**
* Returns a [SortedSet] of all elements.
*/
public fun ByteArray.toSortedSet(): SortedSet {
return toCollection(TreeSet())
}
/**
* Returns a [SortedSet] of all elements.
*/
public fun CharArray.toSortedSet(): SortedSet {
return toCollection(TreeSet())
}
/**
* Returns a [SortedSet] of all elements.
*/
public fun DoubleArray.toSortedSet(): SortedSet {
return toCollection(TreeSet())
}
/**
* Returns a [SortedSet] of all elements.
*/
public fun FloatArray.toSortedSet(): SortedSet