Fix formatting in Engine and templates
This commit is contained in:
committed by
Andrey Breslav
parent
f14ca2cf89
commit
89c1260627
File diff suppressed because it is too large
Load Diff
@@ -10,126 +10,126 @@ import java.util.*
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun <T> Array<out T>.isEmpty() : Boolean {
|
||||
public fun <T> Array<out T>.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun BooleanArray.isEmpty() : Boolean {
|
||||
public fun BooleanArray.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun ByteArray.isEmpty() : Boolean {
|
||||
public fun ByteArray.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun CharArray.isEmpty() : Boolean {
|
||||
public fun CharArray.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun DoubleArray.isEmpty() : Boolean {
|
||||
public fun DoubleArray.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun FloatArray.isEmpty() : Boolean {
|
||||
public fun FloatArray.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun IntArray.isEmpty() : Boolean {
|
||||
public fun IntArray.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun LongArray.isEmpty() : Boolean {
|
||||
public fun LongArray.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is empty
|
||||
*/
|
||||
public fun ShortArray.isEmpty() : Boolean {
|
||||
public fun ShortArray.isEmpty(): Boolean {
|
||||
return size == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun <T> Array<out T>.isNotEmpty() : Boolean {
|
||||
public fun <T> Array<out T>.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun BooleanArray.isNotEmpty() : Boolean {
|
||||
public fun BooleanArray.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun ByteArray.isNotEmpty() : Boolean {
|
||||
public fun ByteArray.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun CharArray.isNotEmpty() : Boolean {
|
||||
public fun CharArray.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun DoubleArray.isNotEmpty() : Boolean {
|
||||
public fun DoubleArray.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun FloatArray.isNotEmpty() : Boolean {
|
||||
public fun FloatArray.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun IntArray.isNotEmpty() : Boolean {
|
||||
public fun IntArray.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun LongArray.isNotEmpty() : Boolean {
|
||||
public fun LongArray.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the array is not empty
|
||||
*/
|
||||
public fun ShortArray.isNotEmpty() : Boolean {
|
||||
public fun ShortArray.isNotEmpty(): Boolean {
|
||||
return !isEmpty()
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -10,52 +10,48 @@ import java.util.*
|
||||
/**
|
||||
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
|
||||
*/
|
||||
public fun <T:Any> Array<T?>.requireNoNulls() : Array<T> {
|
||||
public fun <T : Any> Array<T?>.requireNoNulls(): Array<T> {
|
||||
for (element in this) {
|
||||
if (element == null) {
|
||||
throw IllegalArgumentException("null element found in $this")
|
||||
}
|
||||
}
|
||||
return this as Array<T>
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
|
||||
*/
|
||||
public fun <T:Any> Iterable<T?>.requireNoNulls() : Iterable<T> {
|
||||
public fun <T : Any> Iterable<T?>.requireNoNulls(): Iterable<T> {
|
||||
for (element in this) {
|
||||
if (element == null) {
|
||||
throw IllegalArgumentException("null element found in $this")
|
||||
}
|
||||
}
|
||||
return this as Iterable<T>
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
|
||||
*/
|
||||
public fun <T:Any> List<T?>.requireNoNulls() : List<T> {
|
||||
public fun <T : Any> List<T?>.requireNoNulls(): List<T> {
|
||||
for (element in this) {
|
||||
if (element == null) {
|
||||
throw IllegalArgumentException("null element found in $this")
|
||||
}
|
||||
}
|
||||
return this as List<T>
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
|
||||
*/
|
||||
public fun <T:Any> Stream<T?>.requireNoNulls() : Stream<T> {
|
||||
public fun <T : Any> Stream<T?>.requireNoNulls(): Stream<T> {
|
||||
return FilteringStream(this) {
|
||||
if (it == null) {
|
||||
throw IllegalArgumentException("null element found in $this")
|
||||
}
|
||||
true
|
||||
} as Stream<T>
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,208 +10,192 @@ import java.util.*
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Iterable<Int>.sum() : Int {
|
||||
public fun Iterable<Int>.sum(): Int {
|
||||
val iterator = iterator()
|
||||
var sum : Int = 0
|
||||
var sum: Int = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Iterable<Long>.sum() : Long {
|
||||
public fun Iterable<Long>.sum(): Long {
|
||||
val iterator = iterator()
|
||||
var sum : Long = 0
|
||||
var sum: Long = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Iterable<Double>.sum() : Double {
|
||||
public fun Iterable<Double>.sum(): Double {
|
||||
val iterator = iterator()
|
||||
var sum : Double = 0.0
|
||||
var sum: Double = 0.0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Iterable<Float>.sum() : Float {
|
||||
public fun Iterable<Float>.sum(): Float {
|
||||
val iterator = iterator()
|
||||
var sum : Float = 0.0f
|
||||
var sum: Float = 0.0f
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Array<out Int>.sum() : Int {
|
||||
public fun Array<out Int>.sum(): Int {
|
||||
val iterator = iterator()
|
||||
var sum : Int = 0
|
||||
var sum: Int = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun IntArray.sum() : Int {
|
||||
public fun IntArray.sum(): Int {
|
||||
val iterator = iterator()
|
||||
var sum : Int = 0
|
||||
var sum: Int = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Array<out Long>.sum() : Long {
|
||||
public fun Array<out Long>.sum(): Long {
|
||||
val iterator = iterator()
|
||||
var sum : Long = 0
|
||||
var sum: Long = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun LongArray.sum() : Long {
|
||||
public fun LongArray.sum(): Long {
|
||||
val iterator = iterator()
|
||||
var sum : Long = 0
|
||||
var sum: Long = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Array<out Byte>.sum() : Int {
|
||||
public fun Array<out Byte>.sum(): Int {
|
||||
val iterator = iterator()
|
||||
var sum : Int = 0
|
||||
var sum: Int = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun ByteArray.sum() : Int {
|
||||
public fun ByteArray.sum(): Int {
|
||||
val iterator = iterator()
|
||||
var sum : Int = 0
|
||||
var sum: Int = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Array<out Short>.sum() : Int {
|
||||
public fun Array<out Short>.sum(): Int {
|
||||
val iterator = iterator()
|
||||
var sum : Int = 0
|
||||
var sum: Int = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun ShortArray.sum() : Int {
|
||||
public fun ShortArray.sum(): Int {
|
||||
val iterator = iterator()
|
||||
var sum : Int = 0
|
||||
var sum: Int = 0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Array<out Double>.sum() : Double {
|
||||
public fun Array<out Double>.sum(): Double {
|
||||
val iterator = iterator()
|
||||
var sum : Double = 0.0
|
||||
var sum: Double = 0.0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun DoubleArray.sum() : Double {
|
||||
public fun DoubleArray.sum(): Double {
|
||||
val iterator = iterator()
|
||||
var sum : Double = 0.0
|
||||
var sum: Double = 0.0
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun Array<out Float>.sum() : Float {
|
||||
public fun Array<out Float>.sum(): Float {
|
||||
val iterator = iterator()
|
||||
var sum : Float = 0.0f
|
||||
var sum: Float = 0.0f
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sum of all elements in the collection
|
||||
*/
|
||||
public fun FloatArray.sum() : Float {
|
||||
public fun FloatArray.sum(): Float {
|
||||
val iterator = iterator()
|
||||
var sum : Float = 0.0f
|
||||
var sum: Float = 0.0f
|
||||
while (iterator.hasNext()) {
|
||||
sum += iterator.next()
|
||||
}
|
||||
return sum
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,193 +10,174 @@ import java.util.*
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun <T> Array<out T>.reverse() : List<T> {
|
||||
public fun <T> Array<out T>.reverse(): List<T> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun BooleanArray.reverse() : List<Boolean> {
|
||||
public fun BooleanArray.reverse(): List<Boolean> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun ByteArray.reverse() : List<Byte> {
|
||||
public fun ByteArray.reverse(): List<Byte> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun CharArray.reverse() : List<Char> {
|
||||
public fun CharArray.reverse(): List<Char> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun DoubleArray.reverse() : List<Double> {
|
||||
public fun DoubleArray.reverse(): List<Double> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun FloatArray.reverse() : List<Float> {
|
||||
public fun FloatArray.reverse(): List<Float> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun IntArray.reverse() : List<Int> {
|
||||
public fun IntArray.reverse(): List<Int> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun LongArray.reverse() : List<Long> {
|
||||
public fun LongArray.reverse(): List<Long> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun ShortArray.reverse() : List<Short> {
|
||||
public fun ShortArray.reverse(): List<Short> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with elements in reversed order
|
||||
*/
|
||||
public fun <T> Iterable<T>.reverse() : List<T> {
|
||||
public fun <T> Iterable<T>.reverse(): List<T> {
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with characters in reversed order
|
||||
*/
|
||||
public fun String.reverse() : String {
|
||||
public fun String.reverse(): String {
|
||||
return StringBuilder().append(this).reverse().toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun <T: Comparable<T>> Iterable<T>.sort() : List<T> {
|
||||
public fun <T : Comparable<T>> Iterable<T>.sort(): List<T> {
|
||||
val sortedList = toArrayList()
|
||||
java.util.Collections.sort(sortedList)
|
||||
return sortedList
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements, sorted by the specified *comparator*
|
||||
*/
|
||||
public fun <T> Array<out T>.sortBy(comparator : Comparator<T>) : List<T> {
|
||||
public fun <T> Array<out T>.sortBy(comparator: Comparator<T>): List<T> {
|
||||
val sortedList = toArrayList()
|
||||
java.util.Collections.sort(sortedList, comparator)
|
||||
return sortedList
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements, sorted by the specified *comparator*
|
||||
*/
|
||||
public fun <T> Iterable<T>.sortBy(comparator : Comparator<T>) : List<T> {
|
||||
public fun <T> Iterable<T>.sortBy(comparator: Comparator<T>): List<T> {
|
||||
val sortedList = toArrayList()
|
||||
java.util.Collections.sort(sortedList, comparator)
|
||||
return sortedList
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements, sorted by results of specified *order* function.
|
||||
*/
|
||||
public inline fun <T, R: Comparable<R>> Array<out T>.sortBy(order: (T) -> R) : List<T> {
|
||||
public inline fun <T, R : Comparable<R>> Array<out T>.sortBy(order: (T) -> R): List<T> {
|
||||
val sortedList = toArrayList()
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> order(x).compareTo(order(y))}
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> order(x).compareTo(order(y)) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
return sortedList
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements, sorted by results of specified *order* function.
|
||||
*/
|
||||
public inline fun <T, R: Comparable<R>> Iterable<T>.sortBy(order: (T) -> R) : List<T> {
|
||||
public inline fun <T, R : Comparable<R>> Iterable<T>.sortBy(order: (T) -> R): List<T> {
|
||||
val sortedList = toArrayList()
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> order(x).compareTo(order(y))}
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> order(x).compareTo(order(y)) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
return sortedList
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun <T: Comparable<T>> Iterable<T>.sortDescending() : List<T> {
|
||||
public fun <T : Comparable<T>> Iterable<T>.sortDescending(): List<T> {
|
||||
val sortedList = toArrayList()
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -x.compareTo(y)}
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -x.compareTo(y) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
return sortedList
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements, sorted by results of specified *order* function.
|
||||
*/
|
||||
public inline fun <T, R: Comparable<R>> Array<out T>.sortDescendingBy(order: (T) -> R) : List<T> {
|
||||
public inline fun <T, R : Comparable<R>> Array<out T>.sortDescendingBy(order: (T) -> R): List<T> {
|
||||
val sortedList = toArrayList()
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -order(x).compareTo(order(y))}
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -order(x).compareTo(order(y)) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
return sortedList
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements, sorted by results of specified *order* function.
|
||||
*/
|
||||
public inline fun <T, R: Comparable<R>> Iterable<T>.sortDescendingBy(order: (T) -> R) : List<T> {
|
||||
public inline fun <T, R : Comparable<R>> Iterable<T>.sortDescendingBy(order: (T) -> R): List<T> {
|
||||
val sortedList = toArrayList()
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -order(x).compareTo(order(y))}
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -order(x).compareTo(order(y)) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
return sortedList
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,771 +10,742 @@ import java.util.*
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun <T> Array<out T>.toArrayList() : ArrayList<T> {
|
||||
public fun <T> Array<out T>.toArrayList(): ArrayList<T> {
|
||||
val list = ArrayList<T>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun BooleanArray.toArrayList() : ArrayList<Boolean> {
|
||||
public fun BooleanArray.toArrayList(): ArrayList<Boolean> {
|
||||
val list = ArrayList<Boolean>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun ByteArray.toArrayList() : ArrayList<Byte> {
|
||||
public fun ByteArray.toArrayList(): ArrayList<Byte> {
|
||||
val list = ArrayList<Byte>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun CharArray.toArrayList() : ArrayList<Char> {
|
||||
public fun CharArray.toArrayList(): ArrayList<Char> {
|
||||
val list = ArrayList<Char>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun DoubleArray.toArrayList() : ArrayList<Double> {
|
||||
public fun DoubleArray.toArrayList(): ArrayList<Double> {
|
||||
val list = ArrayList<Double>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun FloatArray.toArrayList() : ArrayList<Float> {
|
||||
public fun FloatArray.toArrayList(): ArrayList<Float> {
|
||||
val list = ArrayList<Float>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun IntArray.toArrayList() : ArrayList<Int> {
|
||||
public fun IntArray.toArrayList(): ArrayList<Int> {
|
||||
val list = ArrayList<Int>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun LongArray.toArrayList() : ArrayList<Long> {
|
||||
public fun LongArray.toArrayList(): ArrayList<Long> {
|
||||
val list = ArrayList<Long>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun ShortArray.toArrayList() : ArrayList<Short> {
|
||||
public fun ShortArray.toArrayList(): ArrayList<Short> {
|
||||
val list = ArrayList<Short>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun <T> Iterable<T>.toArrayList() : ArrayList<T> {
|
||||
public fun <T> Iterable<T>.toArrayList(): ArrayList<T> {
|
||||
return toCollection(ArrayList<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun <T> Stream<T>.toArrayList() : ArrayList<T> {
|
||||
public fun <T> Stream<T>.toArrayList(): ArrayList<T> {
|
||||
return toCollection(ArrayList<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ArrayList of all elements
|
||||
*/
|
||||
public fun String.toArrayList() : ArrayList<Char> {
|
||||
public fun String.toArrayList(): ArrayList<Char> {
|
||||
return toCollection(ArrayList<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <T, C : MutableCollection<in T>> Array<out T>.toCollection(collection : C) : C {
|
||||
public fun <T, C : MutableCollection<in T>> Array<out T>.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Boolean>> BooleanArray.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Boolean>> BooleanArray.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Byte>> ByteArray.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Byte>> ByteArray.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Char>> CharArray.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Char>> CharArray.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Double>> DoubleArray.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Double>> DoubleArray.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Float>> FloatArray.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Float>> FloatArray.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Int>> IntArray.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Int>> IntArray.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Long>> LongArray.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Long>> LongArray.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Short>> ShortArray.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Short>> ShortArray.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <T, C : MutableCollection<in T>> Iterable<T>.toCollection(collection : C) : C {
|
||||
public fun <T, C : MutableCollection<in T>> Iterable<T>.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <T, C : MutableCollection<in T>> Stream<T>.toCollection(collection : C) : C {
|
||||
public fun <T, C : MutableCollection<in T>> Stream<T>.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements to the given *collection*
|
||||
*/
|
||||
public fun <C : MutableCollection<in Char>> String.toCollection(collection : C) : C {
|
||||
public fun <C : MutableCollection<in Char>> String.toCollection(collection: C): C {
|
||||
for (item in this) {
|
||||
collection.add(item)
|
||||
}
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun <T> Array<out T>.toHashSet() : HashSet<T> {
|
||||
public fun <T> Array<out T>.toHashSet(): HashSet<T> {
|
||||
return toCollection(HashSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun BooleanArray.toHashSet() : HashSet<Boolean> {
|
||||
public fun BooleanArray.toHashSet(): HashSet<Boolean> {
|
||||
return toCollection(HashSet<Boolean>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun ByteArray.toHashSet() : HashSet<Byte> {
|
||||
public fun ByteArray.toHashSet(): HashSet<Byte> {
|
||||
return toCollection(HashSet<Byte>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun CharArray.toHashSet() : HashSet<Char> {
|
||||
public fun CharArray.toHashSet(): HashSet<Char> {
|
||||
return toCollection(HashSet<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun DoubleArray.toHashSet() : HashSet<Double> {
|
||||
public fun DoubleArray.toHashSet(): HashSet<Double> {
|
||||
return toCollection(HashSet<Double>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun FloatArray.toHashSet() : HashSet<Float> {
|
||||
public fun FloatArray.toHashSet(): HashSet<Float> {
|
||||
return toCollection(HashSet<Float>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun IntArray.toHashSet() : HashSet<Int> {
|
||||
public fun IntArray.toHashSet(): HashSet<Int> {
|
||||
return toCollection(HashSet<Int>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun LongArray.toHashSet() : HashSet<Long> {
|
||||
public fun LongArray.toHashSet(): HashSet<Long> {
|
||||
return toCollection(HashSet<Long>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun ShortArray.toHashSet() : HashSet<Short> {
|
||||
public fun ShortArray.toHashSet(): HashSet<Short> {
|
||||
return toCollection(HashSet<Short>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun <T> Iterable<T>.toHashSet() : HashSet<T> {
|
||||
public fun <T> Iterable<T>.toHashSet(): HashSet<T> {
|
||||
return toCollection(HashSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun <T> Stream<T>.toHashSet() : HashSet<T> {
|
||||
public fun <T> Stream<T>.toHashSet(): HashSet<T> {
|
||||
return toCollection(HashSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a HashSet of all elements
|
||||
*/
|
||||
public fun String.toHashSet() : HashSet<Char> {
|
||||
public fun String.toHashSet(): HashSet<Char> {
|
||||
return toCollection(HashSet<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun <T> Array<out T>.toLinkedList() : LinkedList<T> {
|
||||
public fun <T> Array<out T>.toLinkedList(): LinkedList<T> {
|
||||
return toCollection(LinkedList<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun BooleanArray.toLinkedList() : LinkedList<Boolean> {
|
||||
public fun BooleanArray.toLinkedList(): LinkedList<Boolean> {
|
||||
return toCollection(LinkedList<Boolean>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun ByteArray.toLinkedList() : LinkedList<Byte> {
|
||||
public fun ByteArray.toLinkedList(): LinkedList<Byte> {
|
||||
return toCollection(LinkedList<Byte>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun CharArray.toLinkedList() : LinkedList<Char> {
|
||||
public fun CharArray.toLinkedList(): LinkedList<Char> {
|
||||
return toCollection(LinkedList<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun DoubleArray.toLinkedList() : LinkedList<Double> {
|
||||
public fun DoubleArray.toLinkedList(): LinkedList<Double> {
|
||||
return toCollection(LinkedList<Double>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun FloatArray.toLinkedList() : LinkedList<Float> {
|
||||
public fun FloatArray.toLinkedList(): LinkedList<Float> {
|
||||
return toCollection(LinkedList<Float>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun IntArray.toLinkedList() : LinkedList<Int> {
|
||||
public fun IntArray.toLinkedList(): LinkedList<Int> {
|
||||
return toCollection(LinkedList<Int>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun LongArray.toLinkedList() : LinkedList<Long> {
|
||||
public fun LongArray.toLinkedList(): LinkedList<Long> {
|
||||
return toCollection(LinkedList<Long>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun ShortArray.toLinkedList() : LinkedList<Short> {
|
||||
public fun ShortArray.toLinkedList(): LinkedList<Short> {
|
||||
return toCollection(LinkedList<Short>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun <T> Iterable<T>.toLinkedList() : LinkedList<T> {
|
||||
public fun <T> Iterable<T>.toLinkedList(): LinkedList<T> {
|
||||
return toCollection(LinkedList<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun <T> Stream<T>.toLinkedList() : LinkedList<T> {
|
||||
public fun <T> Stream<T>.toLinkedList(): LinkedList<T> {
|
||||
return toCollection(LinkedList<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LinkedList containing all elements
|
||||
*/
|
||||
public fun String.toLinkedList() : LinkedList<Char> {
|
||||
public fun String.toLinkedList(): LinkedList<Char> {
|
||||
return toCollection(LinkedList<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun <T> Array<out T>.toList() : List<T> {
|
||||
public fun <T> Array<out T>.toList(): List<T> {
|
||||
return toCollection(ArrayList<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun BooleanArray.toList() : List<Boolean> {
|
||||
public fun BooleanArray.toList(): List<Boolean> {
|
||||
val list = ArrayList<Boolean>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun ByteArray.toList() : List<Byte> {
|
||||
public fun ByteArray.toList(): List<Byte> {
|
||||
val list = ArrayList<Byte>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun CharArray.toList() : List<Char> {
|
||||
public fun CharArray.toList(): List<Char> {
|
||||
val list = ArrayList<Char>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun DoubleArray.toList() : List<Double> {
|
||||
public fun DoubleArray.toList(): List<Double> {
|
||||
val list = ArrayList<Double>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun FloatArray.toList() : List<Float> {
|
||||
public fun FloatArray.toList(): List<Float> {
|
||||
val list = ArrayList<Float>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun IntArray.toList() : List<Int> {
|
||||
public fun IntArray.toList(): List<Int> {
|
||||
val list = ArrayList<Int>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun LongArray.toList() : List<Long> {
|
||||
public fun LongArray.toList(): List<Long> {
|
||||
val list = ArrayList<Long>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun ShortArray.toList() : List<Short> {
|
||||
public fun ShortArray.toList(): List<Short> {
|
||||
val list = ArrayList<Short>(size)
|
||||
for (item in this) list.add(item)
|
||||
return list
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun <T> Iterable<T>.toList() : List<T> {
|
||||
public fun <T> Iterable<T>.toList(): List<T> {
|
||||
return toCollection(ArrayList<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun <T> Stream<T>.toList() : List<T> {
|
||||
public fun <T> Stream<T>.toList(): List<T> {
|
||||
return toCollection(ArrayList<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List containing all elements
|
||||
*/
|
||||
public fun String.toList() : List<Char> {
|
||||
public fun String.toList(): List<Char> {
|
||||
return toCollection(ArrayList<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun <T> Array<out T>.toSet() : Set<T> {
|
||||
public fun <T> Array<out T>.toSet(): Set<T> {
|
||||
return toCollection(LinkedHashSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun BooleanArray.toSet() : Set<Boolean> {
|
||||
public fun BooleanArray.toSet(): Set<Boolean> {
|
||||
return toCollection(LinkedHashSet<Boolean>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun ByteArray.toSet() : Set<Byte> {
|
||||
public fun ByteArray.toSet(): Set<Byte> {
|
||||
return toCollection(LinkedHashSet<Byte>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun CharArray.toSet() : Set<Char> {
|
||||
public fun CharArray.toSet(): Set<Char> {
|
||||
return toCollection(LinkedHashSet<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun DoubleArray.toSet() : Set<Double> {
|
||||
public fun DoubleArray.toSet(): Set<Double> {
|
||||
return toCollection(LinkedHashSet<Double>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun FloatArray.toSet() : Set<Float> {
|
||||
public fun FloatArray.toSet(): Set<Float> {
|
||||
return toCollection(LinkedHashSet<Float>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun IntArray.toSet() : Set<Int> {
|
||||
public fun IntArray.toSet(): Set<Int> {
|
||||
return toCollection(LinkedHashSet<Int>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun LongArray.toSet() : Set<Long> {
|
||||
public fun LongArray.toSet(): Set<Long> {
|
||||
return toCollection(LinkedHashSet<Long>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun ShortArray.toSet() : Set<Short> {
|
||||
public fun ShortArray.toSet(): Set<Short> {
|
||||
return toCollection(LinkedHashSet<Short>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun <T> Iterable<T>.toSet() : Set<T> {
|
||||
public fun <T> Iterable<T>.toSet(): Set<T> {
|
||||
return toCollection(LinkedHashSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun <T> Stream<T>.toSet() : Set<T> {
|
||||
public fun <T> Stream<T>.toSet(): Set<T> {
|
||||
return toCollection(LinkedHashSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set of all elements
|
||||
*/
|
||||
public fun String.toSet() : Set<Char> {
|
||||
public fun String.toSet(): Set<Char> {
|
||||
return toCollection(LinkedHashSet<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun <T: Comparable<T>> Array<out T>.toSortedList() : List<T> {
|
||||
public fun <T : Comparable<T>> Array<out T>.toSortedList(): List<T> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun BooleanArray.toSortedList() : List<Boolean> {
|
||||
public fun BooleanArray.toSortedList(): List<Boolean> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun ByteArray.toSortedList() : List<Byte> {
|
||||
public fun ByteArray.toSortedList(): List<Byte> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun CharArray.toSortedList() : List<Char> {
|
||||
public fun CharArray.toSortedList(): List<Char> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun DoubleArray.toSortedList() : List<Double> {
|
||||
public fun DoubleArray.toSortedList(): List<Double> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun FloatArray.toSortedList() : List<Float> {
|
||||
public fun FloatArray.toSortedList(): List<Float> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun IntArray.toSortedList() : List<Int> {
|
||||
public fun IntArray.toSortedList(): List<Int> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun LongArray.toSortedList() : List<Long> {
|
||||
public fun LongArray.toSortedList(): List<Long> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun ShortArray.toSortedList() : List<Short> {
|
||||
public fun ShortArray.toSortedList(): List<Short> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun <T: Comparable<T>> Iterable<T>.toSortedList() : List<T> {
|
||||
public fun <T : Comparable<T>> Iterable<T>.toSortedList(): List<T> {
|
||||
return sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun <T: Comparable<T>> Stream<T>.toSortedList() : List<T> {
|
||||
public fun <T : Comparable<T>> Stream<T>.toSortedList(): List<T> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted list of all elements
|
||||
*/
|
||||
public fun String.toSortedList() : List<Char> {
|
||||
public fun String.toSortedList(): List<Char> {
|
||||
return toArrayList().sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun <T> Array<out T>.toSortedSet() : SortedSet<T> {
|
||||
public fun <T> Array<out T>.toSortedSet(): SortedSet<T> {
|
||||
return toCollection(TreeSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun BooleanArray.toSortedSet() : SortedSet<Boolean> {
|
||||
public fun BooleanArray.toSortedSet(): SortedSet<Boolean> {
|
||||
return toCollection(TreeSet<Boolean>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun ByteArray.toSortedSet() : SortedSet<Byte> {
|
||||
public fun ByteArray.toSortedSet(): SortedSet<Byte> {
|
||||
return toCollection(TreeSet<Byte>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun CharArray.toSortedSet() : SortedSet<Char> {
|
||||
public fun CharArray.toSortedSet(): SortedSet<Char> {
|
||||
return toCollection(TreeSet<Char>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun DoubleArray.toSortedSet() : SortedSet<Double> {
|
||||
public fun DoubleArray.toSortedSet(): SortedSet<Double> {
|
||||
return toCollection(TreeSet<Double>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun FloatArray.toSortedSet() : SortedSet<Float> {
|
||||
public fun FloatArray.toSortedSet(): SortedSet<Float> {
|
||||
return toCollection(TreeSet<Float>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun IntArray.toSortedSet() : SortedSet<Int> {
|
||||
public fun IntArray.toSortedSet(): SortedSet<Int> {
|
||||
return toCollection(TreeSet<Int>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun LongArray.toSortedSet() : SortedSet<Long> {
|
||||
public fun LongArray.toSortedSet(): SortedSet<Long> {
|
||||
return toCollection(TreeSet<Long>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun ShortArray.toSortedSet() : SortedSet<Short> {
|
||||
public fun ShortArray.toSortedSet(): SortedSet<Short> {
|
||||
return toCollection(TreeSet<Short>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun <T> Iterable<T>.toSortedSet() : SortedSet<T> {
|
||||
public fun <T> Iterable<T>.toSortedSet(): SortedSet<T> {
|
||||
return toCollection(TreeSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun <T> Stream<T>.toSortedSet() : SortedSet<T> {
|
||||
public fun <T> Stream<T>.toSortedSet(): SortedSet<T> {
|
||||
return toCollection(TreeSet<T>())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a SortedSet of all elements
|
||||
*/
|
||||
public fun String.toSortedSet() : SortedSet<Char> {
|
||||
public fun String.toSortedSet(): SortedSet<Char> {
|
||||
return toCollection(TreeSet<Char>())
|
||||
}
|
||||
|
||||
|
||||
@@ -10,450 +10,433 @@ import java.util.*
|
||||
/**
|
||||
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted.
|
||||
*/
|
||||
public fun <T> Array<out T>.binarySearch(element: T, fromIndex: Int = 0, toIndex: Int = size - 1) : Int {
|
||||
public fun <T> Array<out T>.binarySearch(element: T, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted.
|
||||
*/
|
||||
public fun ByteArray.binarySearch(element: Byte, fromIndex: Int = 0, toIndex: Int = size - 1) : Int {
|
||||
public fun ByteArray.binarySearch(element: Byte, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted.
|
||||
*/
|
||||
public fun CharArray.binarySearch(element: Char, fromIndex: Int = 0, toIndex: Int = size - 1) : Int {
|
||||
public fun CharArray.binarySearch(element: Char, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted.
|
||||
*/
|
||||
public fun DoubleArray.binarySearch(element: Double, fromIndex: Int = 0, toIndex: Int = size - 1) : Int {
|
||||
public fun DoubleArray.binarySearch(element: Double, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted.
|
||||
*/
|
||||
public fun FloatArray.binarySearch(element: Float, fromIndex: Int = 0, toIndex: Int = size - 1) : Int {
|
||||
public fun FloatArray.binarySearch(element: Float, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted.
|
||||
*/
|
||||
public fun IntArray.binarySearch(element: Int, fromIndex: Int = 0, toIndex: Int = size - 1) : Int {
|
||||
public fun IntArray.binarySearch(element: Int, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted.
|
||||
*/
|
||||
public fun LongArray.binarySearch(element: Long, fromIndex: Int = 0, toIndex: Int = size - 1) : Int {
|
||||
public fun LongArray.binarySearch(element: Long, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches array or range of array for provided element index using binary search algorithm. Array is expected to be sorted.
|
||||
*/
|
||||
public fun ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex: Int = size - 1) : Int {
|
||||
public fun ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun <T> Array<out T>.copyOf() : Array<T> {
|
||||
public fun <T> Array<out T>.copyOf(): Array<T> {
|
||||
return Arrays.copyOf(this, size) as Array<T>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun BooleanArray.copyOf() : BooleanArray {
|
||||
public fun BooleanArray.copyOf(): BooleanArray {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun ByteArray.copyOf() : ByteArray {
|
||||
public fun ByteArray.copyOf(): ByteArray {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun CharArray.copyOf() : CharArray {
|
||||
public fun CharArray.copyOf(): CharArray {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun DoubleArray.copyOf() : DoubleArray {
|
||||
public fun DoubleArray.copyOf(): DoubleArray {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun FloatArray.copyOf() : FloatArray {
|
||||
public fun FloatArray.copyOf(): FloatArray {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun IntArray.copyOf() : IntArray {
|
||||
public fun IntArray.copyOf(): IntArray {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun LongArray.copyOf() : LongArray {
|
||||
public fun LongArray.copyOf(): LongArray {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun ShortArray.copyOf() : ShortArray {
|
||||
public fun ShortArray.copyOf(): ShortArray {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun <T> Array<out T>.copyOf(newSize: Int) : Array<T?> {
|
||||
public fun <T> Array<out T>.copyOf(newSize: Int): Array<T?> {
|
||||
return Arrays.copyOf(this, newSize) as Array<T?>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun BooleanArray.copyOf(newSize: Int) : BooleanArray {
|
||||
public fun BooleanArray.copyOf(newSize: Int): BooleanArray {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun ByteArray.copyOf(newSize: Int) : ByteArray {
|
||||
public fun ByteArray.copyOf(newSize: Int): ByteArray {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun CharArray.copyOf(newSize: Int) : CharArray {
|
||||
public fun CharArray.copyOf(newSize: Int): CharArray {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun DoubleArray.copyOf(newSize: Int) : DoubleArray {
|
||||
public fun DoubleArray.copyOf(newSize: Int): DoubleArray {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun FloatArray.copyOf(newSize: Int) : FloatArray {
|
||||
public fun FloatArray.copyOf(newSize: Int): FloatArray {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun IntArray.copyOf(newSize: Int) : IntArray {
|
||||
public fun IntArray.copyOf(newSize: Int): IntArray {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun LongArray.copyOf(newSize: Int) : LongArray {
|
||||
public fun LongArray.copyOf(newSize: Int): LongArray {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array
|
||||
*/
|
||||
public fun ShortArray.copyOf(newSize: Int) : ShortArray {
|
||||
public fun ShortArray.copyOf(newSize: Int): ShortArray {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun <T> Array<out T>.copyOfRange(from: Int, to: Int) : Array<T> {
|
||||
public fun <T> Array<out T>.copyOfRange(from: Int, to: Int): Array<T> {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun BooleanArray.copyOfRange(from: Int, to: Int) : BooleanArray {
|
||||
public fun BooleanArray.copyOfRange(from: Int, to: Int): BooleanArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun ByteArray.copyOfRange(from: Int, to: Int) : ByteArray {
|
||||
public fun ByteArray.copyOfRange(from: Int, to: Int): ByteArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun CharArray.copyOfRange(from: Int, to: Int) : CharArray {
|
||||
public fun CharArray.copyOfRange(from: Int, to: Int): CharArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun DoubleArray.copyOfRange(from: Int, to: Int) : DoubleArray {
|
||||
public fun DoubleArray.copyOfRange(from: Int, to: Int): DoubleArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun FloatArray.copyOfRange(from: Int, to: Int) : FloatArray {
|
||||
public fun FloatArray.copyOfRange(from: Int, to: Int): FloatArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun IntArray.copyOfRange(from: Int, to: Int) : IntArray {
|
||||
public fun IntArray.copyOfRange(from: Int, to: Int): IntArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun LongArray.copyOfRange(from: Int, to: Int) : LongArray {
|
||||
public fun LongArray.copyOfRange(from: Int, to: Int): LongArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array
|
||||
*/
|
||||
public fun ShortArray.copyOfRange(from: Int, to: Int) : ShortArray {
|
||||
public fun ShortArray.copyOfRange(from: Int, to: Int): ShortArray {
|
||||
return Arrays.copyOfRange(this, from, to)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun <T> Array<out T>.fill(element: T) : Array<out T> {
|
||||
public fun <T> Array<out T>.fill(element: T): Array<out T> {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun BooleanArray.fill(element: Boolean) : BooleanArray {
|
||||
public fun BooleanArray.fill(element: Boolean): BooleanArray {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun ByteArray.fill(element: Byte) : ByteArray {
|
||||
public fun ByteArray.fill(element: Byte): ByteArray {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun CharArray.fill(element: Char) : CharArray {
|
||||
public fun CharArray.fill(element: Char): CharArray {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun DoubleArray.fill(element: Double) : DoubleArray {
|
||||
public fun DoubleArray.fill(element: Double): DoubleArray {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun FloatArray.fill(element: Float) : FloatArray {
|
||||
public fun FloatArray.fill(element: Float): FloatArray {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun IntArray.fill(element: Int) : IntArray {
|
||||
public fun IntArray.fill(element: Int): IntArray {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun LongArray.fill(element: Long) : LongArray {
|
||||
public fun LongArray.fill(element: Long): LongArray {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value
|
||||
*/
|
||||
public fun ShortArray.fill(element: Short) : ShortArray {
|
||||
public fun ShortArray.fill(element: Short): ShortArray {
|
||||
Arrays.fill(this, element)
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements that are instances of specified class
|
||||
*/
|
||||
public fun <T, R: T> Array<out T>.filterIsInstance(klass: Class<R>) : List<R> {
|
||||
public fun <T, R : T> Array<out T>.filterIsInstance(klass: Class<R>): List<R> {
|
||||
return filterIsInstanceTo(ArrayList<R>(), klass)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements that are instances of specified class
|
||||
*/
|
||||
public fun <T, R: T> Iterable<T>.filterIsInstance(klass: Class<R>) : List<R> {
|
||||
public fun <T, R : T> Iterable<T>.filterIsInstance(klass: Class<R>): List<R> {
|
||||
return filterIsInstanceTo(ArrayList<R>(), klass)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream containing all elements that are instances of specified class
|
||||
*/
|
||||
public fun <T, R: T> Stream<T>.filterIsInstance(klass: Class<R>) : Stream<T> {
|
||||
public fun <T, R : T> Stream<T>.filterIsInstance(klass: Class<R>): Stream<T> {
|
||||
return FilteringStream(this, true, { klass.isInstance(it) })
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements that are instances of specified class
|
||||
*/
|
||||
public fun <R: Char> String.filterIsInstance(klass: Class<R>) : List<R> {
|
||||
public fun <R : Char> String.filterIsInstance(klass: Class<R>): List<R> {
|
||||
return filterIsInstanceTo(ArrayList<R>(), klass)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements that are instances of specified class into the given *collection*
|
||||
*/
|
||||
public fun <T, C: MutableCollection<in R>, R: T> Array<out T>.filterIsInstanceTo(collection: C, klass: Class<R>) : C {
|
||||
public fun <T, C : MutableCollection<in R>, R : T> Array<out T>.filterIsInstanceTo(collection: C, klass: Class<R>): C {
|
||||
for (element in this) if (klass.isInstance(element)) collection.add(element as R)
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements that are instances of specified class into the given *collection*
|
||||
*/
|
||||
public fun <T, C: MutableCollection<in R>, R: T> Iterable<T>.filterIsInstanceTo(collection: C, klass: Class<R>) : C {
|
||||
public fun <T, C : MutableCollection<in R>, R : T> Iterable<T>.filterIsInstanceTo(collection: C, klass: Class<R>): C {
|
||||
for (element in this) if (klass.isInstance(element)) collection.add(element as R)
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements that are instances of specified class into the given *collection*
|
||||
*/
|
||||
public fun <T, C: MutableCollection<in R>, R: T> Stream<T>.filterIsInstanceTo(collection: C, klass: Class<R>) : C {
|
||||
public fun <T, C : MutableCollection<in R>, R : T> Stream<T>.filterIsInstanceTo(collection: C, klass: Class<R>): C {
|
||||
for (element in this) if (klass.isInstance(element)) collection.add(element as R)
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all elements that are instances of specified class into the given *collection*
|
||||
*/
|
||||
public fun <C: MutableCollection<in R>, R: Char> String.filterIsInstanceTo(collection: C, klass: Class<R>) : C {
|
||||
public fun <C : MutableCollection<in R>, R : Char> String.filterIsInstanceTo(collection: C, klass: Class<R>): C {
|
||||
for (element in this) if (klass.isInstance(element)) collection.add(element as R)
|
||||
return collection
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts array or range in array inplace
|
||||
*/
|
||||
public fun <T> Array<out T>.sort(fromIndex : Int = 0, toIndex : Int = size - 1) : Unit {
|
||||
public fun <T> Array<out T>.sort(fromIndex: Int = 0, toIndex: Int = size - 1): Unit {
|
||||
Arrays.sort(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts array or range in array inplace
|
||||
*/
|
||||
public fun ByteArray.sort(fromIndex : Int = 0, toIndex : Int = size - 1) : Unit {
|
||||
public fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size - 1): Unit {
|
||||
Arrays.sort(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts array or range in array inplace
|
||||
*/
|
||||
public fun CharArray.sort(fromIndex : Int = 0, toIndex : Int = size - 1) : Unit {
|
||||
public fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size - 1): Unit {
|
||||
Arrays.sort(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts array or range in array inplace
|
||||
*/
|
||||
public fun DoubleArray.sort(fromIndex : Int = 0, toIndex : Int = size - 1) : Unit {
|
||||
public fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size - 1): Unit {
|
||||
Arrays.sort(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts array or range in array inplace
|
||||
*/
|
||||
public fun FloatArray.sort(fromIndex : Int = 0, toIndex : Int = size - 1) : Unit {
|
||||
public fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size - 1): Unit {
|
||||
Arrays.sort(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts array or range in array inplace
|
||||
*/
|
||||
public fun IntArray.sort(fromIndex : Int = 0, toIndex : Int = size - 1) : Unit {
|
||||
public fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size - 1): Unit {
|
||||
Arrays.sort(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts array or range in array inplace
|
||||
*/
|
||||
public fun LongArray.sort(fromIndex : Int = 0, toIndex : Int = size - 1) : Unit {
|
||||
public fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size - 1): Unit {
|
||||
Arrays.sort(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts array or range in array inplace
|
||||
*/
|
||||
public fun ShortArray.sort(fromIndex : Int = 0, toIndex : Int = size - 1) : Unit {
|
||||
public fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size - 1): Unit {
|
||||
Arrays.sort(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,96 +10,128 @@ import java.util.*
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun <T> Array<out T>.stream() : Stream<T> {
|
||||
return object : Stream<T> { override fun iterator() : Iterator<T> { return this@stream.iterator() } }
|
||||
|
||||
public fun <T> Array<out T>.stream(): Stream<T> {
|
||||
return object : Stream<T> {
|
||||
override fun iterator(): Iterator<T> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun BooleanArray.stream() : Stream<Boolean> {
|
||||
return object : Stream<Boolean> { override fun iterator() : Iterator<Boolean> { return this@stream.iterator() } }
|
||||
|
||||
public fun BooleanArray.stream(): Stream<Boolean> {
|
||||
return object : Stream<Boolean> {
|
||||
override fun iterator(): Iterator<Boolean> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun ByteArray.stream() : Stream<Byte> {
|
||||
return object : Stream<Byte> { override fun iterator() : Iterator<Byte> { return this@stream.iterator() } }
|
||||
|
||||
public fun ByteArray.stream(): Stream<Byte> {
|
||||
return object : Stream<Byte> {
|
||||
override fun iterator(): Iterator<Byte> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun CharArray.stream() : Stream<Char> {
|
||||
return object : Stream<Char> { override fun iterator() : Iterator<Char> { return this@stream.iterator() } }
|
||||
|
||||
public fun CharArray.stream(): Stream<Char> {
|
||||
return object : Stream<Char> {
|
||||
override fun iterator(): Iterator<Char> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun DoubleArray.stream() : Stream<Double> {
|
||||
return object : Stream<Double> { override fun iterator() : Iterator<Double> { return this@stream.iterator() } }
|
||||
|
||||
public fun DoubleArray.stream(): Stream<Double> {
|
||||
return object : Stream<Double> {
|
||||
override fun iterator(): Iterator<Double> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun FloatArray.stream() : Stream<Float> {
|
||||
return object : Stream<Float> { override fun iterator() : Iterator<Float> { return this@stream.iterator() } }
|
||||
|
||||
public fun FloatArray.stream(): Stream<Float> {
|
||||
return object : Stream<Float> {
|
||||
override fun iterator(): Iterator<Float> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun IntArray.stream() : Stream<Int> {
|
||||
return object : Stream<Int> { override fun iterator() : Iterator<Int> { return this@stream.iterator() } }
|
||||
|
||||
public fun IntArray.stream(): Stream<Int> {
|
||||
return object : Stream<Int> {
|
||||
override fun iterator(): Iterator<Int> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun LongArray.stream() : Stream<Long> {
|
||||
return object : Stream<Long> { override fun iterator() : Iterator<Long> { return this@stream.iterator() } }
|
||||
|
||||
public fun LongArray.stream(): Stream<Long> {
|
||||
return object : Stream<Long> {
|
||||
override fun iterator(): Iterator<Long> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun ShortArray.stream() : Stream<Short> {
|
||||
return object : Stream<Short> { override fun iterator() : Iterator<Short> { return this@stream.iterator() } }
|
||||
|
||||
public fun ShortArray.stream(): Stream<Short> {
|
||||
return object : Stream<Short> {
|
||||
override fun iterator(): Iterator<Short> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun <T> Iterable<T>.stream() : Stream<T> {
|
||||
return object : Stream<T> { override fun iterator() : Iterator<T> { return this@stream.iterator() } }
|
||||
|
||||
public fun <T> Iterable<T>.stream(): Stream<T> {
|
||||
return object : Stream<T> {
|
||||
override fun iterator(): Iterator<T> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun <T> Stream<T>.stream() : Stream<T> {
|
||||
public fun <T> Stream<T>.stream(): Stream<T> {
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream from the given collection
|
||||
*/
|
||||
public fun String.stream() : Stream<Char> {
|
||||
return object : Stream<Char> { override fun iterator() : Iterator<Char> { return this@stream.iterator() } }
|
||||
|
||||
public fun String.stream(): Stream<Char> {
|
||||
return object : Stream<Char> {
|
||||
override fun iterator(): Iterator<Char> {
|
||||
return this@stream.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.*
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun <T> Array<out T>.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun <T> Array<out T>.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -24,7 +24,6 @@ public fun <T> Array<out T>.appendString(buffer: Appendable, separator: String =
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +31,7 @@ public fun <T> Array<out T>.appendString(buffer: Appendable, separator: String =
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun BooleanArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun BooleanArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -44,7 +43,6 @@ public fun BooleanArray.appendString(buffer: Appendable, separator: String = ",
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +50,7 @@ public fun BooleanArray.appendString(buffer: Appendable, separator: String = ",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun ByteArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun ByteArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -64,7 +62,6 @@ public fun ByteArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +69,7 @@ public fun ByteArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun CharArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun CharArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -84,7 +81,6 @@ public fun CharArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +88,7 @@ public fun CharArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun DoubleArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun DoubleArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -104,7 +100,6 @@ public fun DoubleArray.appendString(buffer: Appendable, separator: String = ", "
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +107,7 @@ public fun DoubleArray.appendString(buffer: Appendable, separator: String = ", "
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun FloatArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun FloatArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -124,7 +119,6 @@ public fun FloatArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +126,7 @@ public fun FloatArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun IntArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun IntArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -144,7 +138,6 @@ public fun IntArray.appendString(buffer: Appendable, separator: String = ", ", p
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +145,7 @@ public fun IntArray.appendString(buffer: Appendable, separator: String = ", ", p
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun LongArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun LongArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -164,7 +157,6 @@ public fun LongArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +164,7 @@ public fun LongArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun ShortArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun ShortArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -184,7 +176,6 @@ public fun ShortArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,7 +183,7 @@ public fun ShortArray.appendString(buffer: Appendable, separator: String = ", ",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun <T> Iterable<T>.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun <T> Iterable<T>.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -204,7 +195,6 @@ public fun <T> Iterable<T>.appendString(buffer: Appendable, separator: String =
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +202,7 @@ public fun <T> Iterable<T>.appendString(buffer: Appendable, separator: String =
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun <T> Stream<T>.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun <T> Stream<T>.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -224,7 +214,6 @@ public fun <T> Stream<T>.appendString(buffer: Appendable, separator: String = ",
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +221,7 @@ public fun <T> Stream<T>.appendString(buffer: Appendable, separator: String = ",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun String.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
|
||||
public fun String.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
@@ -244,7 +233,6 @@ public fun String.appendString(buffer: Appendable, separator: String = ", ", pre
|
||||
}
|
||||
if (limit >= 0 && count > limit) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,11 +240,10 @@ public fun String.appendString(buffer: Appendable, separator: String = ", ", pre
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun <T> Array<out T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun <T> Array<out T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,11 +251,10 @@ public fun <T> Array<out T>.makeString(separator: String = ", ", prefix: String
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun BooleanArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun BooleanArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,11 +262,10 @@ public fun BooleanArray.makeString(separator: String = ", ", prefix: String = ""
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun ByteArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun ByteArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,11 +273,10 @@ public fun ByteArray.makeString(separator: String = ", ", prefix: String = "", p
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun CharArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun CharArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,11 +284,10 @@ public fun CharArray.makeString(separator: String = ", ", prefix: String = "", p
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun DoubleArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun DoubleArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,11 +295,10 @@ public fun DoubleArray.makeString(separator: String = ", ", prefix: String = "",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun FloatArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun FloatArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -324,11 +306,10 @@ public fun FloatArray.makeString(separator: String = ", ", prefix: String = "",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun IntArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun IntArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -336,11 +317,10 @@ public fun IntArray.makeString(separator: String = ", ", prefix: String = "", po
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun LongArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun LongArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,11 +328,10 @@ public fun LongArray.makeString(separator: String = ", ", prefix: String = "", p
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun ShortArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun ShortArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -360,11 +339,10 @@ public fun ShortArray.makeString(separator: String = ", ", prefix: String = "",
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun <T> Iterable<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun <T> Iterable<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -372,11 +350,10 @@ public fun <T> Iterable<T>.makeString(separator: String = ", ", prefix: String =
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun <T> Stream<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun <T> Stream<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -384,10 +361,9 @@ public fun <T> Stream<T>.makeString(separator: String = ", ", prefix: String = "
|
||||
* If a collection could be huge you can specify a non-negative value of *limit* which will only show a subset of the collection then it will
|
||||
* a special *truncated* separator (which defaults to "..."
|
||||
*/
|
||||
public fun String.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
|
||||
public fun String.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user