Apply infix modifier on functions from stdlib where appropriate.

This commit is contained in:
Ilya Gorbunov
2015-11-14 18:34:06 +03:00
parent 794819cea2
commit a426c7879f
9 changed files with 75 additions and 69 deletions
+53 -53
View File
@@ -7307,7 +7307,7 @@ public inline fun <K> ShortArray.distinctBy(keySelector: (Short) -> K): List<Sho
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun <T> Array<out T>.intersect(other: Iterable<T>): Set<T> {
public infix fun <T> Array<out T>.intersect(other: Iterable<T>): Set<T> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7316,7 +7316,7 @@ public fun <T> Array<out T>.intersect(other: Iterable<T>): Set<T> {
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun BooleanArray.intersect(other: Iterable<Boolean>): Set<Boolean> {
public infix fun BooleanArray.intersect(other: Iterable<Boolean>): Set<Boolean> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7325,7 +7325,7 @@ public fun BooleanArray.intersect(other: Iterable<Boolean>): Set<Boolean> {
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun ByteArray.intersect(other: Iterable<Byte>): Set<Byte> {
public infix fun ByteArray.intersect(other: Iterable<Byte>): Set<Byte> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7334,7 +7334,7 @@ public fun ByteArray.intersect(other: Iterable<Byte>): Set<Byte> {
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun CharArray.intersect(other: Iterable<Char>): Set<Char> {
public infix fun CharArray.intersect(other: Iterable<Char>): Set<Char> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7343,7 +7343,7 @@ public fun CharArray.intersect(other: Iterable<Char>): Set<Char> {
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun DoubleArray.intersect(other: Iterable<Double>): Set<Double> {
public infix fun DoubleArray.intersect(other: Iterable<Double>): Set<Double> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7352,7 +7352,7 @@ public fun DoubleArray.intersect(other: Iterable<Double>): Set<Double> {
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun FloatArray.intersect(other: Iterable<Float>): Set<Float> {
public infix fun FloatArray.intersect(other: Iterable<Float>): Set<Float> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7361,7 +7361,7 @@ public fun FloatArray.intersect(other: Iterable<Float>): Set<Float> {
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun IntArray.intersect(other: Iterable<Int>): Set<Int> {
public infix fun IntArray.intersect(other: Iterable<Int>): Set<Int> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7370,7 +7370,7 @@ public fun IntArray.intersect(other: Iterable<Int>): Set<Int> {
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun LongArray.intersect(other: Iterable<Long>): Set<Long> {
public infix fun LongArray.intersect(other: Iterable<Long>): Set<Long> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7379,7 +7379,7 @@ public fun LongArray.intersect(other: Iterable<Long>): Set<Long> {
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun ShortArray.intersect(other: Iterable<Short>): Set<Short> {
public infix fun ShortArray.intersect(other: Iterable<Short>): Set<Short> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -7388,7 +7388,7 @@ public fun ShortArray.intersect(other: Iterable<Short>): Set<Short> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun <T> Array<out T>.subtract(other: Iterable<T>): Set<T> {
public infix fun <T> Array<out T>.subtract(other: Iterable<T>): Set<T> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7397,7 +7397,7 @@ public fun <T> Array<out T>.subtract(other: Iterable<T>): Set<T> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun BooleanArray.subtract(other: Iterable<Boolean>): Set<Boolean> {
public infix fun BooleanArray.subtract(other: Iterable<Boolean>): Set<Boolean> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7406,7 +7406,7 @@ public fun BooleanArray.subtract(other: Iterable<Boolean>): Set<Boolean> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun ByteArray.subtract(other: Iterable<Byte>): Set<Byte> {
public infix fun ByteArray.subtract(other: Iterable<Byte>): Set<Byte> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7415,7 +7415,7 @@ public fun ByteArray.subtract(other: Iterable<Byte>): Set<Byte> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun CharArray.subtract(other: Iterable<Char>): Set<Char> {
public infix fun CharArray.subtract(other: Iterable<Char>): Set<Char> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7424,7 +7424,7 @@ public fun CharArray.subtract(other: Iterable<Char>): Set<Char> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun DoubleArray.subtract(other: Iterable<Double>): Set<Double> {
public infix fun DoubleArray.subtract(other: Iterable<Double>): Set<Double> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7433,7 +7433,7 @@ public fun DoubleArray.subtract(other: Iterable<Double>): Set<Double> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun FloatArray.subtract(other: Iterable<Float>): Set<Float> {
public infix fun FloatArray.subtract(other: Iterable<Float>): Set<Float> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7442,7 +7442,7 @@ public fun FloatArray.subtract(other: Iterable<Float>): Set<Float> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun IntArray.subtract(other: Iterable<Int>): Set<Int> {
public infix fun IntArray.subtract(other: Iterable<Int>): Set<Int> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7451,7 +7451,7 @@ public fun IntArray.subtract(other: Iterable<Int>): Set<Int> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun LongArray.subtract(other: Iterable<Long>): Set<Long> {
public infix fun LongArray.subtract(other: Iterable<Long>): Set<Long> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7460,7 +7460,7 @@ public fun LongArray.subtract(other: Iterable<Long>): Set<Long> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun ShortArray.subtract(other: Iterable<Short>): Set<Short> {
public infix fun ShortArray.subtract(other: Iterable<Short>): Set<Short> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -7550,7 +7550,7 @@ public fun ShortArray.toMutableSet(): MutableSet<Short> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun <T> Array<out T>.union(other: Iterable<T>): Set<T> {
public infix fun <T> Array<out T>.union(other: Iterable<T>): Set<T> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -7559,7 +7559,7 @@ public fun <T> Array<out T>.union(other: Iterable<T>): Set<T> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun BooleanArray.union(other: Iterable<Boolean>): Set<Boolean> {
public infix fun BooleanArray.union(other: Iterable<Boolean>): Set<Boolean> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -7568,7 +7568,7 @@ public fun BooleanArray.union(other: Iterable<Boolean>): Set<Boolean> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun ByteArray.union(other: Iterable<Byte>): Set<Byte> {
public infix fun ByteArray.union(other: Iterable<Byte>): Set<Byte> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -7577,7 +7577,7 @@ public fun ByteArray.union(other: Iterable<Byte>): Set<Byte> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun CharArray.union(other: Iterable<Char>): Set<Char> {
public infix fun CharArray.union(other: Iterable<Char>): Set<Char> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -7586,7 +7586,7 @@ public fun CharArray.union(other: Iterable<Char>): Set<Char> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun DoubleArray.union(other: Iterable<Double>): Set<Double> {
public infix fun DoubleArray.union(other: Iterable<Double>): Set<Double> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -7595,7 +7595,7 @@ public fun DoubleArray.union(other: Iterable<Double>): Set<Double> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun FloatArray.union(other: Iterable<Float>): Set<Float> {
public infix fun FloatArray.union(other: Iterable<Float>): Set<Float> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -7604,7 +7604,7 @@ public fun FloatArray.union(other: Iterable<Float>): Set<Float> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun IntArray.union(other: Iterable<Int>): Set<Int> {
public infix fun IntArray.union(other: Iterable<Int>): Set<Int> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -7613,7 +7613,7 @@ public fun IntArray.union(other: Iterable<Int>): Set<Int> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun LongArray.union(other: Iterable<Long>): Set<Long> {
public infix fun LongArray.union(other: Iterable<Long>): Set<Long> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -7622,7 +7622,7 @@ public fun LongArray.union(other: Iterable<Long>): Set<Long> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun ShortArray.union(other: Iterable<Short>): Set<Short> {
public infix fun ShortArray.union(other: Iterable<Short>): Set<Short> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -9597,63 +9597,63 @@ public inline fun ShortArray.partition(predicate: (Short) -> Boolean): Pair<List
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <T, R> Array<out T>.zip(array: Array<out R>): List<Pair<T, R>> {
public infix fun <T, R> Array<out T>.zip(array: Array<out R>): List<Pair<T, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> BooleanArray.zip(array: Array<out R>): List<Pair<Boolean, R>> {
public infix fun <R> BooleanArray.zip(array: Array<out R>): List<Pair<Boolean, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> ByteArray.zip(array: Array<out R>): List<Pair<Byte, R>> {
public infix fun <R> ByteArray.zip(array: Array<out R>): List<Pair<Byte, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> CharArray.zip(array: Array<out R>): List<Pair<Char, R>> {
public infix fun <R> CharArray.zip(array: Array<out R>): List<Pair<Char, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> DoubleArray.zip(array: Array<out R>): List<Pair<Double, R>> {
public infix fun <R> DoubleArray.zip(array: Array<out R>): List<Pair<Double, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> FloatArray.zip(array: Array<out R>): List<Pair<Float, R>> {
public infix fun <R> FloatArray.zip(array: Array<out R>): List<Pair<Float, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> IntArray.zip(array: Array<out R>): List<Pair<Int, R>> {
public infix fun <R> IntArray.zip(array: Array<out R>): List<Pair<Int, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> LongArray.zip(array: Array<out R>): List<Pair<Long, R>> {
public infix fun <R> LongArray.zip(array: Array<out R>): List<Pair<Long, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> ShortArray.zip(array: Array<out R>): List<Pair<Short, R>> {
public infix fun <R> ShortArray.zip(array: Array<out R>): List<Pair<Short, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
@@ -9768,56 +9768,56 @@ public inline fun <R, V> ShortArray.zip(array: Array<out R>, transform: (Short,
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun BooleanArray.zip(array: BooleanArray): List<Pair<Boolean, Boolean>> {
public infix fun BooleanArray.zip(array: BooleanArray): List<Pair<Boolean, Boolean>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun ByteArray.zip(array: ByteArray): List<Pair<Byte, Byte>> {
public infix fun ByteArray.zip(array: ByteArray): List<Pair<Byte, Byte>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun CharArray.zip(array: CharArray): List<Pair<Char, Char>> {
public infix fun CharArray.zip(array: CharArray): List<Pair<Char, Char>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun DoubleArray.zip(array: DoubleArray): List<Pair<Double, Double>> {
public infix fun DoubleArray.zip(array: DoubleArray): List<Pair<Double, Double>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun FloatArray.zip(array: FloatArray): List<Pair<Float, Float>> {
public infix fun FloatArray.zip(array: FloatArray): List<Pair<Float, Float>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun IntArray.zip(array: IntArray): List<Pair<Int, Int>> {
public infix fun IntArray.zip(array: IntArray): List<Pair<Int, Int>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun LongArray.zip(array: LongArray): List<Pair<Long, Long>> {
public infix fun LongArray.zip(array: LongArray): List<Pair<Long, Long>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun ShortArray.zip(array: ShortArray): List<Pair<Short, Short>> {
public infix fun ShortArray.zip(array: ShortArray): List<Pair<Short, Short>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
@@ -9920,63 +9920,63 @@ public inline fun <V> ShortArray.zip(array: ShortArray, transform: (Short, Short
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <T, R> Array<out T>.zip(other: Iterable<R>): List<Pair<T, R>> {
public infix fun <T, R> Array<out T>.zip(other: Iterable<R>): List<Pair<T, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> BooleanArray.zip(other: Iterable<R>): List<Pair<Boolean, R>> {
public infix fun <R> BooleanArray.zip(other: Iterable<R>): List<Pair<Boolean, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> ByteArray.zip(other: Iterable<R>): List<Pair<Byte, R>> {
public infix fun <R> ByteArray.zip(other: Iterable<R>): List<Pair<Byte, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> CharArray.zip(other: Iterable<R>): List<Pair<Char, R>> {
public infix fun <R> CharArray.zip(other: Iterable<R>): List<Pair<Char, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> DoubleArray.zip(other: Iterable<R>): List<Pair<Double, R>> {
public infix fun <R> DoubleArray.zip(other: Iterable<R>): List<Pair<Double, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> FloatArray.zip(other: Iterable<R>): List<Pair<Float, R>> {
public infix fun <R> FloatArray.zip(other: Iterable<R>): List<Pair<Float, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> IntArray.zip(other: Iterable<R>): List<Pair<Int, R>> {
public infix fun <R> IntArray.zip(other: Iterable<R>): List<Pair<Int, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> LongArray.zip(other: Iterable<R>): List<Pair<Long, R>> {
public infix fun <R> LongArray.zip(other: Iterable<R>): List<Pair<Long, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <R> ShortArray.zip(other: Iterable<R>): List<Pair<Short, R>> {
public infix fun <R> ShortArray.zip(other: Iterable<R>): List<Pair<Short, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
@@ -1210,7 +1210,7 @@ public inline fun <T, K> Iterable<T>.distinctBy(keySelector: (T) -> K): List<T>
/**
* Returns a set containing all elements that are contained by both this set and the specified collection.
*/
public fun <T> Iterable<T>.intersect(other: Iterable<T>): Set<T> {
public infix fun <T> Iterable<T>.intersect(other: Iterable<T>): Set<T> {
val set = this.toMutableSet()
set.retainAll(other)
return set
@@ -1219,7 +1219,7 @@ public fun <T> Iterable<T>.intersect(other: Iterable<T>): Set<T> {
/**
* Returns a set containing all elements that are contained by this set and not contained by the specified collection.
*/
public fun <T> Iterable<T>.subtract(other: Iterable<T>): Set<T> {
public infix fun <T> Iterable<T>.subtract(other: Iterable<T>): Set<T> {
val set = this.toMutableSet()
set.removeAll(other)
return set
@@ -1238,7 +1238,7 @@ public fun <T> Iterable<T>.toMutableSet(): MutableSet<T> {
/**
* Returns a set containing all distinct elements from both collections.
*/
public fun <T> Iterable<T>.union(other: Iterable<T>): Set<T> {
public infix fun <T> Iterable<T>.union(other: Iterable<T>): Set<T> {
val set = this.toMutableSet()
set.addAll(other)
return set
@@ -1631,7 +1631,7 @@ public operator fun <T> Iterable<T>.plus(sequence: Sequence<T>): List<T> {
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <T, R> Iterable<T>.zip(array: Array<out R>): List<Pair<T, R>> {
public infix fun <T, R> Iterable<T>.zip(array: Array<out R>): List<Pair<T, R>> {
return zip(array) { t1, t2 -> t1 to t2 }
}
@@ -1652,7 +1652,7 @@ public inline fun <T, R, V> Iterable<T>.zip(array: Array<out R>, transform: (T,
/**
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
*/
public fun <T, R> Iterable<T>.zip(other: Iterable<R>): List<Pair<T, R>> {
public infix fun <T, R> Iterable<T>.zip(other: Iterable<R>): List<Pair<T, R>> {
return zip(other) { t1, t2 -> t1 to t2 }
}
+1 -1
View File
@@ -1010,7 +1010,7 @@ public operator fun <T> Sequence<T>.plus(sequence: Sequence<T>): Sequence<T> {
* Returns a sequence of pairs built from elements of both collections with same indexes.
* Resulting sequence has length of shortest input sequence.
*/
public fun <T, R> Sequence<T>.zip(sequence: Sequence<R>): Sequence<Pair<T, R>> {
public infix fun <T, R> Sequence<T>.zip(sequence: Sequence<R>): Sequence<Pair<T, R>> {
return MergingSequence(this, sequence) { t1, t2 -> t1 to t2 }
}
+2 -2
View File
@@ -1568,7 +1568,7 @@ public inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, S
/**
* Returns a list of pairs built from characters of both char sequences with same indexes. List has length of shortest char sequence.
*/
public fun CharSequence.zip(other: String): List<Pair<Char, Char>> {
public infix fun CharSequence.zip(other: String): List<Pair<Char, Char>> {
return zip(other) { c1, c2 -> c1 to c2 }
}
@@ -1576,7 +1576,7 @@ public fun CharSequence.zip(other: String): List<Pair<Char, Char>> {
* Returns a list of pairs built from characters of both char sequences with same indexes. List has length of shortest char sequence.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun String.zip(other: String): List<Pair<Char, Char>> {
public infix fun String.zip(other: String): List<Pair<Char, Char>> {
return zip(other) { c1, c2 -> c1 to c2 }
}
+2 -2
View File
@@ -207,7 +207,7 @@ inline public fun <T> Comparator<T>.thenComparator(crossinline comparison: (T, T
* Combines this comparator and the given [comparator] such that the latter is applied only
* when the former considered values equal.
*/
public fun <T> Comparator<T>.then(comparator: Comparator<in T>): Comparator<T> {
public infix fun <T> Comparator<T>.then(comparator: Comparator<in T>): Comparator<T> {
return object : Comparator<T> {
public override fun compare(a: T, b: T): Int {
val previousCompare = this@then.compare(a, b)
@@ -220,7 +220,7 @@ public fun <T> Comparator<T>.then(comparator: Comparator<in T>): Comparator<T> {
* Combines this comparator and the given [comparator] such that the latter is applied only
* when the former considered values equal.
*/
public fun <T> Comparator<T>.thenDescending(comparator: Comparator<in T>): Comparator<T> {
public infix fun <T> Comparator<T>.thenDescending(comparator: Comparator<in T>): Comparator<T> {
return object : Comparator<T> {
public override fun compare(a: T, b: T): Int {
val previousCompare = this@thenDescending.compare(a, b)
+1 -1
View File
@@ -528,4 +528,4 @@ fun merge(i1: InterfaceDefinition, i2: InterfaceDefinition): InterfaceDefinition
)
}
fun <T> List<T>.merge(other: List<T>) = (this + other).distinct().toList()
infix fun <T> List<T>.merge(other: List<T>) = (this + other).distinct()
@@ -59,11 +59,9 @@ private fun String.replaceWrongConstants(type: Type) = when {
private fun String.replaceKeywords() = if (this in keywords) this + "_" else this
private fun Appendable.renderArgumentsDeclaration(args: List<GenerateAttribute>, omitDefaults: Boolean = false) =
args.map {
StringBuilder {
renderAttributeDeclaration(it, it.override, false, omitDefaults)
}
}.joinTo(this, ", ", "(", ")")
args.joinTo(this, ", ", "(", ")") {
StringBuilder().apply { renderAttributeDeclaration(it, it.override, false, omitDefaults) }
}
private fun renderCall(call: GenerateFunctionCall) = "${call.name.replaceKeywords()}(${call.arguments.joinToString(", ") { it.replaceKeywords() }})"
@@ -582,6 +582,7 @@ fun generators(): List<GenericFunction> {
templates add f("zip(other: Iterable<R>)") {
infix(true)
exclude(Sequences)
doc {
"""
@@ -598,6 +599,7 @@ fun generators(): List<GenericFunction> {
}
templates add f("zip(other: String)") {
infix(true)
deprecate(Strings) { forBinaryCompatibility }
only(CharSequences, Strings)
doc {
@@ -614,6 +616,7 @@ fun generators(): List<GenericFunction> {
}
templates add f("zip(array: Array<out R>)") {
infix(true)
exclude(Sequences)
doc {
"""
@@ -630,6 +633,7 @@ fun generators(): List<GenericFunction> {
}
templates add f("zip(array: SELF)") {
infix(true)
only(ArraysOfPrimitives)
doc {
"""
@@ -645,6 +649,7 @@ fun generators(): List<GenericFunction> {
}
templates add f("zip(sequence: Sequence<R>)") {
infix(true)
only(Sequences)
doc {
"""
@@ -90,6 +90,7 @@ fun sets(): List<GenericFunction> {
}
templates add f("union(other: Iterable<T>)") {
infix(true)
exclude(Strings, Sequences)
doc { "Returns a set containing all distinct elements from both collections." }
returns("Set<T>")
@@ -103,6 +104,7 @@ fun sets(): List<GenericFunction> {
}
templates add f("intersect(other: Iterable<T>)") {
infix(true)
exclude(Strings, Sequences)
doc { "Returns a set containing all elements that are contained by both this set and the specified collection." }
returns("Set<T>")
@@ -116,6 +118,7 @@ fun sets(): List<GenericFunction> {
}
templates add f("subtract(other: Iterable<T>)") {
infix(true)
exclude(Strings, Sequences)
doc { "Returns a set containing all elements that are contained by this set and not contained by the specified collection." }
returns("Set<T>")