Stdlib regenerated

This commit is contained in:
Mikhael Bogdanov
2013-11-20 12:10:35 +04:00
parent 40d7841892
commit 339e639135
12 changed files with 168 additions and 168 deletions
+17 -17
View File
@@ -28,7 +28,7 @@ public inline fun <T> Array<out T>.any(predicate: (T) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun <T> Array<out T>.count(predicate: (T) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun <T> Array<out T>.drop(n: Int) : List<T> {
public fun <T> Array<out T>.drop(n: Int) : List<T> {
return dropWhile(countTo(n))
}
@@ -98,14 +98,14 @@ public inline fun <T> Array<out T>.filterNot(predicate: (T) -> Boolean) : List<T
/**
* Returns a list containing all the non-*null* elements
*/
public inline fun <T:Any> Array<out T?>.filterNotNull() : List<T> {
public fun <T:Any> Array<out T?>.filterNotNull() : List<T> {
return filterNotNullTo<T, ArrayList<T>>(ArrayList<T>())
}
/**
* Filters all non-*null* elements into the given list
*/
public inline fun <T:Any, C: MutableCollection<in T>> Array<out T?>.filterNotNullTo(result: C) : C {
public fun <T:Any, C: MutableCollection<in T>> Array<out T?>.filterNotNullTo(result: C) : C {
for (element in this) if (element != null) result.add(element)
return result
}
@@ -203,7 +203,7 @@ public inline fun <T, K> Array<out T>.groupByTo(result: MutableMap<K, MutableLis
* 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 inline 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()
@@ -309,14 +309,14 @@ public inline fun <T> Array<out T>.partition(predicate: (T) -> Boolean) : Pair<L
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun <T> Array<out T>.plus(collection: Iterable<T>) : List<T> {
public fun <T> Array<out T>.plus(collection: Iterable<T>) : List<T> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun <T> Array<out T>.plus(element: T) : List<T> {
public fun <T> Array<out T>.plus(element: T) : List<T> {
val answer = ArrayList<T>()
toCollection(answer)
answer.add(element)
@@ -326,7 +326,7 @@ public inline fun <T> Array<out T>.plus(element: T) : List<T> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun <T> Array<out T>.plus(iterator: Iterator<T>) : List<T> {
public fun <T> Array<out T>.plus(iterator: Iterator<T>) : List<T> {
val answer = ArrayList<T>()
toCollection(answer)
for (element in iterator) {
@@ -374,7 +374,7 @@ public inline fun <T> Array<out T>.reduceRight(operation: (T, T) -> T) : T {
/**
* Returns a original Iterable containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
*/
public inline fun <T:Any> Array<out T?>.requireNoNulls() : Array<out T> {
public fun <T:Any> Array<out T?>.requireNoNulls() : Array<out T> {
for (element in this) {
if (element == null) {
throw IllegalArgumentException("null element found in $this")
@@ -386,7 +386,7 @@ public inline fun <T:Any> Array<out T?>.requireNoNulls() : Array<out T> {
/**
* Reverses the order the elements into a list
*/
public inline fun <T> Array<out T>.reverse() : List<T> {
public fun <T> Array<out T>.reverse() : List<T> {
val list = toCollection(ArrayList<T>())
Collections.reverse(list)
return list
@@ -410,7 +410,7 @@ public inline fun <T, R: Comparable<R>> Array<out T>.sortBy(f: (T) -> R) : List<
/**
* Returns a list containing the first *n* elements
*/
public inline fun <T> Array<out T>.take(n: Int) : List<T> {
public fun <T> Array<out T>.take(n: Int) : List<T> {
return takeWhile(countTo(n))
}
@@ -432,7 +432,7 @@ public inline fun <T, C: MutableCollection<in T>> Array<out T>.takeWhileTo(resul
/**
* Copies all elements into the given collection
*/
public inline fun <T, C: MutableCollection<in T>> Array<out T>.toCollection(result: C) : C {
public fun <T, C: MutableCollection<in T>> Array<out T>.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -440,35 +440,35 @@ public inline fun <T, C: MutableCollection<in T>> Array<out T>.toCollection(resu
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun <T> Array<out T>.toLinkedList() : LinkedList<T> {
public fun <T> Array<out T>.toLinkedList() : LinkedList<T> {
return toCollection(LinkedList<T>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun <T> Array<out T>.toList() : List<T> {
public fun <T> Array<out T>.toList() : List<T> {
return toCollection(ArrayList<T>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun <T> Array<out T>.toSet() : Set<T> {
public fun <T> Array<out T>.toSet() : Set<T> {
return toCollection(LinkedHashSet<T>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun <T> Array<out T>.toSortedSet() : SortedSet<T> {
public fun <T> Array<out T>.toSortedSet() : SortedSet<T> {
return toCollection(TreeSet<T>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun <T> Array<out T>.withIndices() : Iterator<Pair<Int, T>> {
public fun <T> Array<out T>.withIndices() : Iterator<Pair<Int, T>> {
return IndexIterator(iterator())
}
@@ -28,7 +28,7 @@ public inline fun BooleanArray.any(predicate: (Boolean) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun BooleanArray.count(predicate: (Boolean) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun BooleanArray.drop(n: Int) : List<Boolean> {
public fun BooleanArray.drop(n: Int) : List<Boolean> {
return dropWhile(countTo(n))
}
@@ -202,7 +202,7 @@ public fun BooleanArray.isNotEmpty() : Boolean {
* 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 inline 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()
@@ -282,14 +282,14 @@ public inline fun BooleanArray.partition(predicate: (Boolean) -> Boolean) : Pair
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun BooleanArray.plus(collection: Iterable<Boolean>) : List<Boolean> {
public fun BooleanArray.plus(collection: Iterable<Boolean>) : List<Boolean> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun BooleanArray.plus(element: Boolean) : List<Boolean> {
public fun BooleanArray.plus(element: Boolean) : List<Boolean> {
val answer = ArrayList<Boolean>()
toCollection(answer)
answer.add(element)
@@ -299,7 +299,7 @@ public inline fun BooleanArray.plus(element: Boolean) : List<Boolean> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun BooleanArray.plus(iterator: Iterator<Boolean>) : List<Boolean> {
public fun BooleanArray.plus(iterator: Iterator<Boolean>) : List<Boolean> {
val answer = ArrayList<Boolean>()
toCollection(answer)
for (element in iterator) {
@@ -347,7 +347,7 @@ public inline fun BooleanArray.reduceRight(operation: (Boolean, Boolean) -> Bool
/**
* Reverses the order the elements into a list
*/
public inline fun BooleanArray.reverse() : List<Boolean> {
public fun BooleanArray.reverse() : List<Boolean> {
val list = toCollection(ArrayList<Boolean>())
Collections.reverse(list)
return list
@@ -371,7 +371,7 @@ public inline fun <R: Comparable<R>> BooleanArray.sortBy(f: (Boolean) -> R) : Li
/**
* Returns a list containing the first *n* elements
*/
public inline fun BooleanArray.take(n: Int) : List<Boolean> {
public fun BooleanArray.take(n: Int) : List<Boolean> {
return takeWhile(countTo(n))
}
@@ -393,7 +393,7 @@ public inline fun <C: MutableCollection<in Boolean>> BooleanArray.takeWhileTo(re
/**
* Copies all elements into the given collection
*/
public inline fun <C: MutableCollection<in Boolean>> BooleanArray.toCollection(result: C) : C {
public fun <C: MutableCollection<in Boolean>> BooleanArray.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -401,35 +401,35 @@ public inline fun <C: MutableCollection<in Boolean>> BooleanArray.toCollection(r
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun BooleanArray.toLinkedList() : LinkedList<Boolean> {
public fun BooleanArray.toLinkedList() : LinkedList<Boolean> {
return toCollection(LinkedList<Boolean>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun BooleanArray.toList() : List<Boolean> {
public fun BooleanArray.toList() : List<Boolean> {
return toCollection(ArrayList<Boolean>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun BooleanArray.toSet() : Set<Boolean> {
public fun BooleanArray.toSet() : Set<Boolean> {
return toCollection(LinkedHashSet<Boolean>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun BooleanArray.toSortedSet() : SortedSet<Boolean> {
public fun BooleanArray.toSortedSet() : SortedSet<Boolean> {
return toCollection(TreeSet<Boolean>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun BooleanArray.withIndices() : Iterator<Pair<Int, Boolean>> {
public fun BooleanArray.withIndices() : Iterator<Pair<Int, Boolean>> {
return IndexIterator(iterator())
}
+14 -14
View File
@@ -28,7 +28,7 @@ public inline fun ByteArray.any(predicate: (Byte) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun ByteArray.count(predicate: (Byte) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun ByteArray.drop(n: Int) : List<Byte> {
public fun ByteArray.drop(n: Int) : List<Byte> {
return dropWhile(countTo(n))
}
@@ -202,7 +202,7 @@ public fun ByteArray.isNotEmpty() : Boolean {
* 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 inline 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()
@@ -308,14 +308,14 @@ public inline fun ByteArray.partition(predicate: (Byte) -> Boolean) : Pair<List<
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun ByteArray.plus(collection: Iterable<Byte>) : List<Byte> {
public fun ByteArray.plus(collection: Iterable<Byte>) : List<Byte> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun ByteArray.plus(element: Byte) : List<Byte> {
public fun ByteArray.plus(element: Byte) : List<Byte> {
val answer = ArrayList<Byte>()
toCollection(answer)
answer.add(element)
@@ -325,7 +325,7 @@ public inline fun ByteArray.plus(element: Byte) : List<Byte> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun ByteArray.plus(iterator: Iterator<Byte>) : List<Byte> {
public fun ByteArray.plus(iterator: Iterator<Byte>) : List<Byte> {
val answer = ArrayList<Byte>()
toCollection(answer)
for (element in iterator) {
@@ -373,7 +373,7 @@ public inline fun ByteArray.reduceRight(operation: (Byte, Byte) -> Byte) : Byte
/**
* Reverses the order the elements into a list
*/
public inline fun ByteArray.reverse() : List<Byte> {
public fun ByteArray.reverse() : List<Byte> {
val list = toCollection(ArrayList<Byte>())
Collections.reverse(list)
return list
@@ -397,7 +397,7 @@ public inline fun <R: Comparable<R>> ByteArray.sortBy(f: (Byte) -> R) : List<Byt
/**
* Returns a list containing the first *n* elements
*/
public inline fun ByteArray.take(n: Int) : List<Byte> {
public fun ByteArray.take(n: Int) : List<Byte> {
return takeWhile(countTo(n))
}
@@ -419,7 +419,7 @@ public inline fun <C: MutableCollection<in Byte>> ByteArray.takeWhileTo(result:
/**
* Copies all elements into the given collection
*/
public inline fun <C: MutableCollection<in Byte>> ByteArray.toCollection(result: C) : C {
public fun <C: MutableCollection<in Byte>> ByteArray.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -427,35 +427,35 @@ public inline fun <C: MutableCollection<in Byte>> ByteArray.toCollection(result:
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun ByteArray.toLinkedList() : LinkedList<Byte> {
public fun ByteArray.toLinkedList() : LinkedList<Byte> {
return toCollection(LinkedList<Byte>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun ByteArray.toList() : List<Byte> {
public fun ByteArray.toList() : List<Byte> {
return toCollection(ArrayList<Byte>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun ByteArray.toSet() : Set<Byte> {
public fun ByteArray.toSet() : Set<Byte> {
return toCollection(LinkedHashSet<Byte>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun ByteArray.toSortedSet() : SortedSet<Byte> {
public fun ByteArray.toSortedSet() : SortedSet<Byte> {
return toCollection(TreeSet<Byte>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun ByteArray.withIndices() : Iterator<Pair<Int, Byte>> {
public fun ByteArray.withIndices() : Iterator<Pair<Int, Byte>> {
return IndexIterator(iterator())
}
+14 -14
View File
@@ -28,7 +28,7 @@ public inline fun CharArray.any(predicate: (Char) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun CharArray.count(predicate: (Char) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun CharArray.drop(n: Int) : List<Char> {
public fun CharArray.drop(n: Int) : List<Char> {
return dropWhile(countTo(n))
}
@@ -202,7 +202,7 @@ public fun CharArray.isNotEmpty() : Boolean {
* 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 inline 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()
@@ -282,14 +282,14 @@ public inline fun CharArray.partition(predicate: (Char) -> Boolean) : Pair<List<
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun CharArray.plus(collection: Iterable<Char>) : List<Char> {
public fun CharArray.plus(collection: Iterable<Char>) : List<Char> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun CharArray.plus(element: Char) : List<Char> {
public fun CharArray.plus(element: Char) : List<Char> {
val answer = ArrayList<Char>()
toCollection(answer)
answer.add(element)
@@ -299,7 +299,7 @@ public inline fun CharArray.plus(element: Char) : List<Char> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun CharArray.plus(iterator: Iterator<Char>) : List<Char> {
public fun CharArray.plus(iterator: Iterator<Char>) : List<Char> {
val answer = ArrayList<Char>()
toCollection(answer)
for (element in iterator) {
@@ -347,7 +347,7 @@ public inline fun CharArray.reduceRight(operation: (Char, Char) -> Char) : Char
/**
* Reverses the order the elements into a list
*/
public inline fun CharArray.reverse() : List<Char> {
public fun CharArray.reverse() : List<Char> {
val list = toCollection(ArrayList<Char>())
Collections.reverse(list)
return list
@@ -371,7 +371,7 @@ public inline fun <R: Comparable<R>> CharArray.sortBy(f: (Char) -> R) : List<Cha
/**
* Returns a list containing the first *n* elements
*/
public inline fun CharArray.take(n: Int) : List<Char> {
public fun CharArray.take(n: Int) : List<Char> {
return takeWhile(countTo(n))
}
@@ -393,7 +393,7 @@ public inline fun <C: MutableCollection<in Char>> CharArray.takeWhileTo(result:
/**
* Copies all elements into the given collection
*/
public inline fun <C: MutableCollection<in Char>> CharArray.toCollection(result: C) : C {
public fun <C: MutableCollection<in Char>> CharArray.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -401,35 +401,35 @@ public inline fun <C: MutableCollection<in Char>> CharArray.toCollection(result:
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun CharArray.toLinkedList() : LinkedList<Char> {
public fun CharArray.toLinkedList() : LinkedList<Char> {
return toCollection(LinkedList<Char>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun CharArray.toList() : List<Char> {
public fun CharArray.toList() : List<Char> {
return toCollection(ArrayList<Char>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun CharArray.toSet() : Set<Char> {
public fun CharArray.toSet() : Set<Char> {
return toCollection(LinkedHashSet<Char>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun CharArray.toSortedSet() : SortedSet<Char> {
public fun CharArray.toSortedSet() : SortedSet<Char> {
return toCollection(TreeSet<Char>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun CharArray.withIndices() : Iterator<Pair<Int, Char>> {
public fun CharArray.withIndices() : Iterator<Pair<Int, Char>> {
return IndexIterator(iterator())
}
@@ -10,7 +10,7 @@ import java.util.*
/**
* Returns a original Iterable containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
*/
public inline fun <T:Any> Collection<T?>.requireNoNulls() : Collection<T> {
public fun <T:Any> Collection<T?>.requireNoNulls() : Collection<T> {
for (element in this) {
if (element == null) {
throw IllegalArgumentException("null element found in $this")
+14 -14
View File
@@ -28,7 +28,7 @@ public inline fun DoubleArray.any(predicate: (Double) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun DoubleArray.count(predicate: (Double) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun DoubleArray.drop(n: Int) : List<Double> {
public fun DoubleArray.drop(n: Int) : List<Double> {
return dropWhile(countTo(n))
}
@@ -202,7 +202,7 @@ public fun DoubleArray.isNotEmpty() : Boolean {
* 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 inline 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()
@@ -308,14 +308,14 @@ public inline fun DoubleArray.partition(predicate: (Double) -> Boolean) : Pair<L
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun DoubleArray.plus(collection: Iterable<Double>) : List<Double> {
public fun DoubleArray.plus(collection: Iterable<Double>) : List<Double> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun DoubleArray.plus(element: Double) : List<Double> {
public fun DoubleArray.plus(element: Double) : List<Double> {
val answer = ArrayList<Double>()
toCollection(answer)
answer.add(element)
@@ -325,7 +325,7 @@ public inline fun DoubleArray.plus(element: Double) : List<Double> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun DoubleArray.plus(iterator: Iterator<Double>) : List<Double> {
public fun DoubleArray.plus(iterator: Iterator<Double>) : List<Double> {
val answer = ArrayList<Double>()
toCollection(answer)
for (element in iterator) {
@@ -373,7 +373,7 @@ public inline fun DoubleArray.reduceRight(operation: (Double, Double) -> Double)
/**
* Reverses the order the elements into a list
*/
public inline fun DoubleArray.reverse() : List<Double> {
public fun DoubleArray.reverse() : List<Double> {
val list = toCollection(ArrayList<Double>())
Collections.reverse(list)
return list
@@ -397,7 +397,7 @@ public inline fun <R: Comparable<R>> DoubleArray.sortBy(f: (Double) -> R) : List
/**
* Returns a list containing the first *n* elements
*/
public inline fun DoubleArray.take(n: Int) : List<Double> {
public fun DoubleArray.take(n: Int) : List<Double> {
return takeWhile(countTo(n))
}
@@ -419,7 +419,7 @@ public inline fun <C: MutableCollection<in Double>> DoubleArray.takeWhileTo(resu
/**
* Copies all elements into the given collection
*/
public inline fun <C: MutableCollection<in Double>> DoubleArray.toCollection(result: C) : C {
public fun <C: MutableCollection<in Double>> DoubleArray.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -427,35 +427,35 @@ public inline fun <C: MutableCollection<in Double>> DoubleArray.toCollection(res
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun DoubleArray.toLinkedList() : LinkedList<Double> {
public fun DoubleArray.toLinkedList() : LinkedList<Double> {
return toCollection(LinkedList<Double>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun DoubleArray.toList() : List<Double> {
public fun DoubleArray.toList() : List<Double> {
return toCollection(ArrayList<Double>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun DoubleArray.toSet() : Set<Double> {
public fun DoubleArray.toSet() : Set<Double> {
return toCollection(LinkedHashSet<Double>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun DoubleArray.toSortedSet() : SortedSet<Double> {
public fun DoubleArray.toSortedSet() : SortedSet<Double> {
return toCollection(TreeSet<Double>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun DoubleArray.withIndices() : Iterator<Pair<Int, Double>> {
public fun DoubleArray.withIndices() : Iterator<Pair<Int, Double>> {
return IndexIterator(iterator())
}
+14 -14
View File
@@ -28,7 +28,7 @@ public inline fun FloatArray.any(predicate: (Float) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun FloatArray.count(predicate: (Float) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun FloatArray.drop(n: Int) : List<Float> {
public fun FloatArray.drop(n: Int) : List<Float> {
return dropWhile(countTo(n))
}
@@ -202,7 +202,7 @@ public fun FloatArray.isNotEmpty() : Boolean {
* 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 inline 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()
@@ -308,14 +308,14 @@ public inline fun FloatArray.partition(predicate: (Float) -> Boolean) : Pair<Lis
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun FloatArray.plus(collection: Iterable<Float>) : List<Float> {
public fun FloatArray.plus(collection: Iterable<Float>) : List<Float> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun FloatArray.plus(element: Float) : List<Float> {
public fun FloatArray.plus(element: Float) : List<Float> {
val answer = ArrayList<Float>()
toCollection(answer)
answer.add(element)
@@ -325,7 +325,7 @@ public inline fun FloatArray.plus(element: Float) : List<Float> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun FloatArray.plus(iterator: Iterator<Float>) : List<Float> {
public fun FloatArray.plus(iterator: Iterator<Float>) : List<Float> {
val answer = ArrayList<Float>()
toCollection(answer)
for (element in iterator) {
@@ -373,7 +373,7 @@ public inline fun FloatArray.reduceRight(operation: (Float, Float) -> Float) : F
/**
* Reverses the order the elements into a list
*/
public inline fun FloatArray.reverse() : List<Float> {
public fun FloatArray.reverse() : List<Float> {
val list = toCollection(ArrayList<Float>())
Collections.reverse(list)
return list
@@ -397,7 +397,7 @@ public inline fun <R: Comparable<R>> FloatArray.sortBy(f: (Float) -> R) : List<F
/**
* Returns a list containing the first *n* elements
*/
public inline fun FloatArray.take(n: Int) : List<Float> {
public fun FloatArray.take(n: Int) : List<Float> {
return takeWhile(countTo(n))
}
@@ -419,7 +419,7 @@ public inline fun <C: MutableCollection<in Float>> FloatArray.takeWhileTo(result
/**
* Copies all elements into the given collection
*/
public inline fun <C: MutableCollection<in Float>> FloatArray.toCollection(result: C) : C {
public fun <C: MutableCollection<in Float>> FloatArray.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -427,35 +427,35 @@ public inline fun <C: MutableCollection<in Float>> FloatArray.toCollection(resul
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun FloatArray.toLinkedList() : LinkedList<Float> {
public fun FloatArray.toLinkedList() : LinkedList<Float> {
return toCollection(LinkedList<Float>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun FloatArray.toList() : List<Float> {
public fun FloatArray.toList() : List<Float> {
return toCollection(ArrayList<Float>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun FloatArray.toSet() : Set<Float> {
public fun FloatArray.toSet() : Set<Float> {
return toCollection(LinkedHashSet<Float>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun FloatArray.toSortedSet() : SortedSet<Float> {
public fun FloatArray.toSortedSet() : SortedSet<Float> {
return toCollection(TreeSet<Float>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun FloatArray.withIndices() : Iterator<Pair<Int, Float>> {
public fun FloatArray.withIndices() : Iterator<Pair<Int, Float>> {
return IndexIterator(iterator())
}
+14 -14
View File
@@ -28,7 +28,7 @@ public inline fun IntArray.any(predicate: (Int) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun IntArray.count(predicate: (Int) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun IntArray.drop(n: Int) : List<Int> {
public fun IntArray.drop(n: Int) : List<Int> {
return dropWhile(countTo(n))
}
@@ -202,7 +202,7 @@ public fun IntArray.isNotEmpty() : Boolean {
* 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 inline 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()
@@ -308,14 +308,14 @@ public inline fun IntArray.partition(predicate: (Int) -> Boolean) : Pair<List<In
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun IntArray.plus(collection: Iterable<Int>) : List<Int> {
public fun IntArray.plus(collection: Iterable<Int>) : List<Int> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun IntArray.plus(element: Int) : List<Int> {
public fun IntArray.plus(element: Int) : List<Int> {
val answer = ArrayList<Int>()
toCollection(answer)
answer.add(element)
@@ -325,7 +325,7 @@ public inline fun IntArray.plus(element: Int) : List<Int> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun IntArray.plus(iterator: Iterator<Int>) : List<Int> {
public fun IntArray.plus(iterator: Iterator<Int>) : List<Int> {
val answer = ArrayList<Int>()
toCollection(answer)
for (element in iterator) {
@@ -373,7 +373,7 @@ public inline fun IntArray.reduceRight(operation: (Int, Int) -> Int) : Int {
/**
* Reverses the order the elements into a list
*/
public inline fun IntArray.reverse() : List<Int> {
public fun IntArray.reverse() : List<Int> {
val list = toCollection(ArrayList<Int>())
Collections.reverse(list)
return list
@@ -397,7 +397,7 @@ public inline fun <R: Comparable<R>> IntArray.sortBy(f: (Int) -> R) : List<Int>
/**
* Returns a list containing the first *n* elements
*/
public inline fun IntArray.take(n: Int) : List<Int> {
public fun IntArray.take(n: Int) : List<Int> {
return takeWhile(countTo(n))
}
@@ -419,7 +419,7 @@ public inline fun <C: MutableCollection<in Int>> IntArray.takeWhileTo(result: C,
/**
* Copies all elements into the given collection
*/
public inline fun <C: MutableCollection<in Int>> IntArray.toCollection(result: C) : C {
public fun <C: MutableCollection<in Int>> IntArray.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -427,35 +427,35 @@ public inline fun <C: MutableCollection<in Int>> IntArray.toCollection(result: C
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun IntArray.toLinkedList() : LinkedList<Int> {
public fun IntArray.toLinkedList() : LinkedList<Int> {
return toCollection(LinkedList<Int>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun IntArray.toList() : List<Int> {
public fun IntArray.toList() : List<Int> {
return toCollection(ArrayList<Int>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun IntArray.toSet() : Set<Int> {
public fun IntArray.toSet() : Set<Int> {
return toCollection(LinkedHashSet<Int>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun IntArray.toSortedSet() : SortedSet<Int> {
public fun IntArray.toSortedSet() : SortedSet<Int> {
return toCollection(TreeSet<Int>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun IntArray.withIndices() : Iterator<Pair<Int, Int>> {
public fun IntArray.withIndices() : Iterator<Pair<Int, Int>> {
return IndexIterator(iterator())
}
+17 -17
View File
@@ -28,7 +28,7 @@ public inline fun <T> Iterable<T>.any(predicate: (T) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun <T> Iterable<T>.count(predicate: (T) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun <T> Iterable<T>.drop(n: Int) : List<T> {
public fun <T> Iterable<T>.drop(n: Int) : List<T> {
return dropWhile(countTo(n))
}
@@ -98,14 +98,14 @@ public inline fun <T> Iterable<T>.filterNot(predicate: (T) -> Boolean) : List<T>
/**
* Returns a list containing all the non-*null* elements
*/
public inline fun <T:Any> Iterable<T?>.filterNotNull() : List<T> {
public fun <T:Any> Iterable<T?>.filterNotNull() : List<T> {
return filterNotNullTo<T, ArrayList<T>>(ArrayList<T>())
}
/**
* Filters all non-*null* elements into the given list
*/
public inline fun <T:Any, C: MutableCollection<in T>> Iterable<T?>.filterNotNullTo(result: C) : C {
public fun <T:Any, C: MutableCollection<in T>> Iterable<T?>.filterNotNullTo(result: C) : C {
for (element in this) if (element != null) result.add(element)
return result
}
@@ -189,7 +189,7 @@ public inline fun <T, K> Iterable<T>.groupByTo(result: MutableMap<K, MutableList
* 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 inline 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()
@@ -297,14 +297,14 @@ public inline fun <T> Iterable<T>.partition(predicate: (T) -> Boolean) : Pair<Li
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun <T> Iterable<T>.plus(collection: Iterable<T>) : List<T> {
public fun <T> Iterable<T>.plus(collection: Iterable<T>) : List<T> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun <T> Iterable<T>.plus(element: T) : List<T> {
public fun <T> Iterable<T>.plus(element: T) : List<T> {
val answer = ArrayList<T>()
toCollection(answer)
answer.add(element)
@@ -314,7 +314,7 @@ public inline fun <T> Iterable<T>.plus(element: T) : List<T> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun <T> Iterable<T>.plus(iterator: Iterator<T>) : List<T> {
public fun <T> Iterable<T>.plus(iterator: Iterator<T>) : List<T> {
val answer = ArrayList<T>()
toCollection(answer)
for (element in iterator) {
@@ -344,7 +344,7 @@ public inline fun <T> Iterable<T>.reduce(operation: (T, T) -> T) : T {
/**
* Returns a original Iterable containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
*/
public inline 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")
@@ -356,7 +356,7 @@ public inline fun <T:Any> Iterable<T?>.requireNoNulls() : Iterable<T> {
/**
* Reverses the order the elements into a list
*/
public inline fun <T> Iterable<T>.reverse() : List<T> {
public fun <T> Iterable<T>.reverse() : List<T> {
val list = toCollection(ArrayList<T>())
Collections.reverse(list)
return list
@@ -380,7 +380,7 @@ public inline fun <T, R: Comparable<R>> Iterable<T>.sortBy(f: (T) -> R) : List<T
/**
* Returns a list containing the first *n* elements
*/
public inline fun <T> Iterable<T>.take(n: Int) : List<T> {
public fun <T> Iterable<T>.take(n: Int) : List<T> {
return takeWhile(countTo(n))
}
@@ -402,7 +402,7 @@ public inline fun <T, C: MutableCollection<in T>> Iterable<T>.takeWhileTo(result
/**
* Copies all elements into the given collection
*/
public inline fun <T, C: MutableCollection<in T>> Iterable<T>.toCollection(result: C) : C {
public fun <T, C: MutableCollection<in T>> Iterable<T>.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -410,35 +410,35 @@ public inline fun <T, C: MutableCollection<in T>> Iterable<T>.toCollection(resul
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun <T> Iterable<T>.toLinkedList() : LinkedList<T> {
public fun <T> Iterable<T>.toLinkedList() : LinkedList<T> {
return toCollection(LinkedList<T>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun <T> Iterable<T>.toList() : List<T> {
public fun <T> Iterable<T>.toList() : List<T> {
return toCollection(ArrayList<T>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun <T> Iterable<T>.toSet() : Set<T> {
public fun <T> Iterable<T>.toSet() : Set<T> {
return toCollection(LinkedHashSet<T>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun <T> Iterable<T>.toSortedSet() : SortedSet<T> {
public fun <T> Iterable<T>.toSortedSet() : SortedSet<T> {
return toCollection(TreeSet<T>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun <T> Iterable<T>.withIndices() : Iterator<Pair<Int, T>> {
public fun <T> Iterable<T>.withIndices() : Iterator<Pair<Int, T>> {
return IndexIterator(iterator())
}
+21 -21
View File
@@ -28,7 +28,7 @@ public inline fun <T> Iterator<T>.any(predicate: (T) -> Boolean) : Boolean {
* 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 inline fun <T> Iterator<T>.appendString(buffer: Appendable, separator: String = ", ", prefix: String ="", postfix: String = "", limit: Int = -1, truncated: String = "...") : Unit {
public fun <T> Iterator<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) {
@@ -54,7 +54,7 @@ public inline fun <T> Iterator<T>.count(predicate: (T) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun <T> Iterator<T>.drop(n: Int) : List<T> {
public fun <T> Iterator<T>.drop(n: Int) : List<T> {
return dropWhile(countTo(n))
}
@@ -84,7 +84,7 @@ public inline fun <T, L: MutableList<in T>> Iterator<T>.dropWhileTo(result: L, p
/**
* Returns an iterator over elements which match the given *predicate*
*/
public inline fun <T> Iterator<T>.filter(predicate: (T) -> Boolean) : Iterator<T> {
public fun <T> Iterator<T>.filter(predicate: (T) -> Boolean) : Iterator<T> {
return FilterIterator<T>(this, predicate)
}
@@ -98,14 +98,14 @@ public inline fun <T> Iterator<T>.filterNot(predicate: (T) -> Boolean) : Iterato
/**
* Returns an iterator over non-*null* elements
*/
public inline fun <T:Any> Iterator<T?>.filterNotNull() : Iterator<T> {
public fun <T:Any> Iterator<T?>.filterNotNull() : Iterator<T> {
return FilterNotNullIterator(this)
}
/**
* Filters all non-*null* elements into the given list
*/
public inline fun <T:Any, C: MutableCollection<in T>> Iterator<T?>.filterNotNullTo(result: C) : C {
public fun <T:Any, C: MutableCollection<in T>> Iterator<T?>.filterNotNullTo(result: C) : C {
for (element in this) if (element != null) result.add(element)
return result
}
@@ -137,7 +137,7 @@ public inline fun <T:Any> Iterator<T>.find(predicate: (T) -> Boolean) : T? {
/**
* Returns an iterator over the concatenated results of transforming each element to one or more values
*/
public inline fun <T, R> Iterator<T>.flatMap(transform: (T) -> Iterator<R>) : Iterator<R> {
public fun <T, R> Iterator<T>.flatMap(transform: (T) -> Iterator<R>) : Iterator<R> {
return FlatMapIterator<T, R>(this, transform)
}
@@ -189,7 +189,7 @@ public inline fun <T, K> Iterator<T>.groupByTo(result: MutableMap<K, MutableList
* 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 inline fun <T> Iterator<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "...") : String {
public fun <T> Iterator<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()
@@ -198,7 +198,7 @@ public inline fun <T> Iterator<T>.makeString(separator: String = ", ", prefix: S
/**
* Returns an iterator obtained by applying *transform*, a function transforming an object of type *T* into an object of type *R*
*/
public inline fun <T, R> Iterator<T>.map(transform : (T) -> R) : Iterator<R> {
public fun <T, R> Iterator<T>.map(transform : (T) -> R) : Iterator<R> {
return MapIterator<T, R>(this, transform)
}
@@ -295,21 +295,21 @@ public inline fun <T> Iterator<T>.partition(predicate: (T) -> Boolean) : Pair<Li
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun <T> Iterator<T>.plus(collection: Iterable<T>) : Iterator<T> {
public fun <T> Iterator<T>.plus(collection: Iterable<T>) : Iterator<T> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun <T> Iterator<T>.plus(element: T) : Iterator<T> {
public fun <T> Iterator<T>.plus(element: T) : Iterator<T> {
return CompositeIterator<T>(this, SingleIterator(element))
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun <T> Iterator<T>.plus(iterator: Iterator<T>) : Iterator<T> {
public fun <T> Iterator<T>.plus(iterator: Iterator<T>) : Iterator<T> {
return CompositeIterator<T>(this, iterator)
}
@@ -334,7 +334,7 @@ public inline fun <T> Iterator<T>.reduce(operation: (T, T) -> T) : T {
/**
* Returns a original Iterable containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
*/
public inline fun <T:Any> Iterator<T?>.requireNoNulls() : Iterator<T> {
public fun <T:Any> Iterator<T?>.requireNoNulls() : Iterator<T> {
return map<T?, T>{
if (it == null) throw IllegalArgumentException("null element in iterator $this") else it
}
@@ -343,7 +343,7 @@ public inline fun <T:Any> Iterator<T?>.requireNoNulls() : Iterator<T> {
/**
* Reverses the order the elements into a list
*/
public inline fun <T> Iterator<T>.reverse() : List<T> {
public fun <T> Iterator<T>.reverse() : List<T> {
val list = toCollection(ArrayList<T>())
Collections.reverse(list)
return list
@@ -367,7 +367,7 @@ public inline fun <T, R: Comparable<R>> Iterator<T>.sortBy(f: (T) -> R) : List<T
/**
* Returns an iterator restricted to the first *n* elements
*/
public inline fun <T> Iterator<T>.take(n: Int) : Iterator<T> {
public fun <T> Iterator<T>.take(n: Int) : Iterator<T> {
var count = n
return takeWhile{ --count >= 0 }
}
@@ -375,7 +375,7 @@ public inline fun <T> Iterator<T>.take(n: Int) : Iterator<T> {
/**
* Returns an iterator restricted to the first elements that match the given *predicate*
*/
public inline fun <T> Iterator<T>.takeWhile(predicate: (T) -> Boolean) : Iterator<T> {
public fun <T> Iterator<T>.takeWhile(predicate: (T) -> Boolean) : Iterator<T> {
return TakeWhileIterator<T>(this, predicate)
}
@@ -390,7 +390,7 @@ public inline fun <T, C: MutableCollection<in T>> Iterator<T>.takeWhileTo(result
/**
* Copies all elements into the given collection
*/
public inline fun <T, C: MutableCollection<in T>> Iterator<T>.toCollection(result: C) : C {
public fun <T, C: MutableCollection<in T>> Iterator<T>.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -398,35 +398,35 @@ public inline fun <T, C: MutableCollection<in T>> Iterator<T>.toCollection(resul
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun <T> Iterator<T>.toLinkedList() : LinkedList<T> {
public fun <T> Iterator<T>.toLinkedList() : LinkedList<T> {
return toCollection(LinkedList<T>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun <T> Iterator<T>.toList() : List<T> {
public fun <T> Iterator<T>.toList() : List<T> {
return toCollection(ArrayList<T>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun <T> Iterator<T>.toSet() : Set<T> {
public fun <T> Iterator<T>.toSet() : Set<T> {
return toCollection(LinkedHashSet<T>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun <T> Iterator<T>.toSortedSet() : SortedSet<T> {
public fun <T> Iterator<T>.toSortedSet() : SortedSet<T> {
return toCollection(TreeSet<T>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun <T> Iterator<T>.withIndices() : Iterator<Pair<Int, T>> {
public fun <T> Iterator<T>.withIndices() : Iterator<Pair<Int, T>> {
return IndexIterator(iterator())
}
+14 -14
View File
@@ -28,7 +28,7 @@ public inline fun LongArray.any(predicate: (Long) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun LongArray.count(predicate: (Long) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun LongArray.drop(n: Int) : List<Long> {
public fun LongArray.drop(n: Int) : List<Long> {
return dropWhile(countTo(n))
}
@@ -202,7 +202,7 @@ public fun LongArray.isNotEmpty() : Boolean {
* 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 inline 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()
@@ -308,14 +308,14 @@ public inline fun LongArray.partition(predicate: (Long) -> Boolean) : Pair<List<
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun LongArray.plus(collection: Iterable<Long>) : List<Long> {
public fun LongArray.plus(collection: Iterable<Long>) : List<Long> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun LongArray.plus(element: Long) : List<Long> {
public fun LongArray.plus(element: Long) : List<Long> {
val answer = ArrayList<Long>()
toCollection(answer)
answer.add(element)
@@ -325,7 +325,7 @@ public inline fun LongArray.plus(element: Long) : List<Long> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun LongArray.plus(iterator: Iterator<Long>) : List<Long> {
public fun LongArray.plus(iterator: Iterator<Long>) : List<Long> {
val answer = ArrayList<Long>()
toCollection(answer)
for (element in iterator) {
@@ -373,7 +373,7 @@ public inline fun LongArray.reduceRight(operation: (Long, Long) -> Long) : Long
/**
* Reverses the order the elements into a list
*/
public inline fun LongArray.reverse() : List<Long> {
public fun LongArray.reverse() : List<Long> {
val list = toCollection(ArrayList<Long>())
Collections.reverse(list)
return list
@@ -397,7 +397,7 @@ public inline fun <R: Comparable<R>> LongArray.sortBy(f: (Long) -> R) : List<Lon
/**
* Returns a list containing the first *n* elements
*/
public inline fun LongArray.take(n: Int) : List<Long> {
public fun LongArray.take(n: Int) : List<Long> {
return takeWhile(countTo(n))
}
@@ -419,7 +419,7 @@ public inline fun <C: MutableCollection<in Long>> LongArray.takeWhileTo(result:
/**
* Copies all elements into the given collection
*/
public inline fun <C: MutableCollection<in Long>> LongArray.toCollection(result: C) : C {
public fun <C: MutableCollection<in Long>> LongArray.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -427,35 +427,35 @@ public inline fun <C: MutableCollection<in Long>> LongArray.toCollection(result:
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun LongArray.toLinkedList() : LinkedList<Long> {
public fun LongArray.toLinkedList() : LinkedList<Long> {
return toCollection(LinkedList<Long>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun LongArray.toList() : List<Long> {
public fun LongArray.toList() : List<Long> {
return toCollection(ArrayList<Long>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun LongArray.toSet() : Set<Long> {
public fun LongArray.toSet() : Set<Long> {
return toCollection(LinkedHashSet<Long>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun LongArray.toSortedSet() : SortedSet<Long> {
public fun LongArray.toSortedSet() : SortedSet<Long> {
return toCollection(TreeSet<Long>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun LongArray.withIndices() : Iterator<Pair<Int, Long>> {
public fun LongArray.withIndices() : Iterator<Pair<Int, Long>> {
return IndexIterator(iterator())
}
+14 -14
View File
@@ -28,7 +28,7 @@ public inline fun ShortArray.any(predicate: (Short) -> Boolean) : Boolean {
* 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 inline 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) {
@@ -54,7 +54,7 @@ public inline fun ShortArray.count(predicate: (Short) -> Boolean) : Int {
/**
* Returns a list containing everything but the first *n* elements
*/
public inline fun ShortArray.drop(n: Int) : List<Short> {
public fun ShortArray.drop(n: Int) : List<Short> {
return dropWhile(countTo(n))
}
@@ -202,7 +202,7 @@ public fun ShortArray.isNotEmpty() : Boolean {
* 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 inline 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()
@@ -308,14 +308,14 @@ public inline fun ShortArray.partition(predicate: (Short) -> Boolean) : Pair<Lis
/**
* Creates an [[Iterator]] which iterates over this iterator then the following collection
*/
public inline fun ShortArray.plus(collection: Iterable<Short>) : List<Short> {
public fun ShortArray.plus(collection: Iterable<Short>) : List<Short> {
return plus(collection.iterator())
}
/**
* Creates an [[Iterator]] which iterates over this iterator then the given element at the end
*/
public inline fun ShortArray.plus(element: Short) : List<Short> {
public fun ShortArray.plus(element: Short) : List<Short> {
val answer = ArrayList<Short>()
toCollection(answer)
answer.add(element)
@@ -325,7 +325,7 @@ public inline fun ShortArray.plus(element: Short) : List<Short> {
/**
* Creates an [[Iterator]] which iterates over this iterator then the following iterator
*/
public inline fun ShortArray.plus(iterator: Iterator<Short>) : List<Short> {
public fun ShortArray.plus(iterator: Iterator<Short>) : List<Short> {
val answer = ArrayList<Short>()
toCollection(answer)
for (element in iterator) {
@@ -373,7 +373,7 @@ public inline fun ShortArray.reduceRight(operation: (Short, Short) -> Short) : S
/**
* Reverses the order the elements into a list
*/
public inline fun ShortArray.reverse() : List<Short> {
public fun ShortArray.reverse() : List<Short> {
val list = toCollection(ArrayList<Short>())
Collections.reverse(list)
return list
@@ -397,7 +397,7 @@ public inline fun <R: Comparable<R>> ShortArray.sortBy(f: (Short) -> R) : List<S
/**
* Returns a list containing the first *n* elements
*/
public inline fun ShortArray.take(n: Int) : List<Short> {
public fun ShortArray.take(n: Int) : List<Short> {
return takeWhile(countTo(n))
}
@@ -419,7 +419,7 @@ public inline fun <C: MutableCollection<in Short>> ShortArray.takeWhileTo(result
/**
* Copies all elements into the given collection
*/
public inline fun <C: MutableCollection<in Short>> ShortArray.toCollection(result: C) : C {
public fun <C: MutableCollection<in Short>> ShortArray.toCollection(result: C) : C {
for (element in this) result.add(element)
return result
}
@@ -427,35 +427,35 @@ public inline fun <C: MutableCollection<in Short>> ShortArray.toCollection(resul
/**
* Copies all elements into a [[LinkedList]]
*/
public inline fun ShortArray.toLinkedList() : LinkedList<Short> {
public fun ShortArray.toLinkedList() : LinkedList<Short> {
return toCollection(LinkedList<Short>())
}
/**
* Copies all elements into a [[List]]
*/
public inline fun ShortArray.toList() : List<Short> {
public fun ShortArray.toList() : List<Short> {
return toCollection(ArrayList<Short>())
}
/**
* Copies all elements into a [[Set]]
*/
public inline fun ShortArray.toSet() : Set<Short> {
public fun ShortArray.toSet() : Set<Short> {
return toCollection(LinkedHashSet<Short>())
}
/**
* Copies all elements into a [[SortedSet]]
*/
public inline fun ShortArray.toSortedSet() : SortedSet<Short> {
public fun ShortArray.toSortedSet() : SortedSet<Short> {
return toCollection(TreeSet<Short>())
}
/**
* Returns an iterator of Pairs(index, data)
*/
public inline fun ShortArray.withIndices() : Iterator<Pair<Int, Short>> {
public fun ShortArray.withIndices() : Iterator<Pair<Int, Short>> {
return IndexIterator(iterator())
}