Mark builtins and stblib functions with 'operator'

This commit is contained in:
Yan Zhulanow
2015-09-18 21:38:35 +03:00
parent ce4bcbba6d
commit 1139a8dd0e
39 changed files with 609 additions and 579 deletions
+61 -61
View File
@@ -14,7 +14,7 @@ import java.util.Collections // TODO: it's temporary while we have java.util.Col
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component1(): T {
public inline operator fun <T> Array<out T>.component1(): T {
return get(0)
}
@@ -22,7 +22,7 @@ public inline fun <T> Array<out T>.component1(): T {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component1(): Boolean {
public inline operator fun BooleanArray.component1(): Boolean {
return get(0)
}
@@ -30,7 +30,7 @@ public inline fun BooleanArray.component1(): Boolean {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component1(): Byte {
public inline operator fun ByteArray.component1(): Byte {
return get(0)
}
@@ -38,7 +38,7 @@ public inline fun ByteArray.component1(): Byte {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component1(): Char {
public inline operator fun CharArray.component1(): Char {
return get(0)
}
@@ -46,7 +46,7 @@ public inline fun CharArray.component1(): Char {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component1(): Double {
public inline operator fun DoubleArray.component1(): Double {
return get(0)
}
@@ -54,7 +54,7 @@ public inline fun DoubleArray.component1(): Double {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component1(): Float {
public inline operator fun FloatArray.component1(): Float {
return get(0)
}
@@ -62,7 +62,7 @@ public inline fun FloatArray.component1(): Float {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component1(): Int {
public inline operator fun IntArray.component1(): Int {
return get(0)
}
@@ -70,7 +70,7 @@ public inline fun IntArray.component1(): Int {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component1(): Long {
public inline operator fun LongArray.component1(): Long {
return get(0)
}
@@ -78,7 +78,7 @@ public inline fun LongArray.component1(): Long {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component1(): Short {
public inline operator fun ShortArray.component1(): Short {
return get(0)
}
@@ -86,7 +86,7 @@ public inline fun ShortArray.component1(): Short {
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component1(): T {
public inline operator fun <T> List<T>.component1(): T {
return get(0)
}
@@ -94,7 +94,7 @@ public inline fun <T> List<T>.component1(): T {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component2(): T {
public inline operator fun <T> Array<out T>.component2(): T {
return get(1)
}
@@ -102,7 +102,7 @@ public inline fun <T> Array<out T>.component2(): T {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component2(): Boolean {
public inline operator fun BooleanArray.component2(): Boolean {
return get(1)
}
@@ -110,7 +110,7 @@ public inline fun BooleanArray.component2(): Boolean {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component2(): Byte {
public inline operator fun ByteArray.component2(): Byte {
return get(1)
}
@@ -118,7 +118,7 @@ public inline fun ByteArray.component2(): Byte {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component2(): Char {
public inline operator fun CharArray.component2(): Char {
return get(1)
}
@@ -126,7 +126,7 @@ public inline fun CharArray.component2(): Char {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component2(): Double {
public inline operator fun DoubleArray.component2(): Double {
return get(1)
}
@@ -134,7 +134,7 @@ public inline fun DoubleArray.component2(): Double {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component2(): Float {
public inline operator fun FloatArray.component2(): Float {
return get(1)
}
@@ -142,7 +142,7 @@ public inline fun FloatArray.component2(): Float {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component2(): Int {
public inline operator fun IntArray.component2(): Int {
return get(1)
}
@@ -150,7 +150,7 @@ public inline fun IntArray.component2(): Int {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component2(): Long {
public inline operator fun LongArray.component2(): Long {
return get(1)
}
@@ -158,7 +158,7 @@ public inline fun LongArray.component2(): Long {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component2(): Short {
public inline operator fun ShortArray.component2(): Short {
return get(1)
}
@@ -166,7 +166,7 @@ public inline fun ShortArray.component2(): Short {
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component2(): T {
public inline operator fun <T> List<T>.component2(): T {
return get(1)
}
@@ -174,7 +174,7 @@ public inline fun <T> List<T>.component2(): T {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component3(): T {
public inline operator fun <T> Array<out T>.component3(): T {
return get(2)
}
@@ -182,7 +182,7 @@ public inline fun <T> Array<out T>.component3(): T {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component3(): Boolean {
public inline operator fun BooleanArray.component3(): Boolean {
return get(2)
}
@@ -190,7 +190,7 @@ public inline fun BooleanArray.component3(): Boolean {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component3(): Byte {
public inline operator fun ByteArray.component3(): Byte {
return get(2)
}
@@ -198,7 +198,7 @@ public inline fun ByteArray.component3(): Byte {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component3(): Char {
public inline operator fun CharArray.component3(): Char {
return get(2)
}
@@ -206,7 +206,7 @@ public inline fun CharArray.component3(): Char {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component3(): Double {
public inline operator fun DoubleArray.component3(): Double {
return get(2)
}
@@ -214,7 +214,7 @@ public inline fun DoubleArray.component3(): Double {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component3(): Float {
public inline operator fun FloatArray.component3(): Float {
return get(2)
}
@@ -222,7 +222,7 @@ public inline fun FloatArray.component3(): Float {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component3(): Int {
public inline operator fun IntArray.component3(): Int {
return get(2)
}
@@ -230,7 +230,7 @@ public inline fun IntArray.component3(): Int {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component3(): Long {
public inline operator fun LongArray.component3(): Long {
return get(2)
}
@@ -238,7 +238,7 @@ public inline fun LongArray.component3(): Long {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component3(): Short {
public inline operator fun ShortArray.component3(): Short {
return get(2)
}
@@ -246,7 +246,7 @@ public inline fun ShortArray.component3(): Short {
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component3(): T {
public inline operator fun <T> List<T>.component3(): T {
return get(2)
}
@@ -254,7 +254,7 @@ public inline fun <T> List<T>.component3(): T {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component4(): T {
public inline operator fun <T> Array<out T>.component4(): T {
return get(3)
}
@@ -262,7 +262,7 @@ public inline fun <T> Array<out T>.component4(): T {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component4(): Boolean {
public inline operator fun BooleanArray.component4(): Boolean {
return get(3)
}
@@ -270,7 +270,7 @@ public inline fun BooleanArray.component4(): Boolean {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component4(): Byte {
public inline operator fun ByteArray.component4(): Byte {
return get(3)
}
@@ -278,7 +278,7 @@ public inline fun ByteArray.component4(): Byte {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component4(): Char {
public inline operator fun CharArray.component4(): Char {
return get(3)
}
@@ -286,7 +286,7 @@ public inline fun CharArray.component4(): Char {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component4(): Double {
public inline operator fun DoubleArray.component4(): Double {
return get(3)
}
@@ -294,7 +294,7 @@ public inline fun DoubleArray.component4(): Double {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component4(): Float {
public inline operator fun FloatArray.component4(): Float {
return get(3)
}
@@ -302,7 +302,7 @@ public inline fun FloatArray.component4(): Float {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component4(): Int {
public inline operator fun IntArray.component4(): Int {
return get(3)
}
@@ -310,7 +310,7 @@ public inline fun IntArray.component4(): Int {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component4(): Long {
public inline operator fun LongArray.component4(): Long {
return get(3)
}
@@ -318,7 +318,7 @@ public inline fun LongArray.component4(): Long {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component4(): Short {
public inline operator fun ShortArray.component4(): Short {
return get(3)
}
@@ -326,7 +326,7 @@ public inline fun ShortArray.component4(): Short {
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component4(): T {
public inline operator fun <T> List<T>.component4(): T {
return get(3)
}
@@ -334,7 +334,7 @@ public inline fun <T> List<T>.component4(): T {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component5(): T {
public inline operator fun <T> Array<out T>.component5(): T {
return get(4)
}
@@ -342,7 +342,7 @@ public inline fun <T> Array<out T>.component5(): T {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component5(): Boolean {
public inline operator fun BooleanArray.component5(): Boolean {
return get(4)
}
@@ -350,7 +350,7 @@ public inline fun BooleanArray.component5(): Boolean {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component5(): Byte {
public inline operator fun ByteArray.component5(): Byte {
return get(4)
}
@@ -358,7 +358,7 @@ public inline fun ByteArray.component5(): Byte {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component5(): Char {
public inline operator fun CharArray.component5(): Char {
return get(4)
}
@@ -366,7 +366,7 @@ public inline fun CharArray.component5(): Char {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component5(): Double {
public inline operator fun DoubleArray.component5(): Double {
return get(4)
}
@@ -374,7 +374,7 @@ public inline fun DoubleArray.component5(): Double {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component5(): Float {
public inline operator fun FloatArray.component5(): Float {
return get(4)
}
@@ -382,7 +382,7 @@ public inline fun FloatArray.component5(): Float {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component5(): Int {
public inline operator fun IntArray.component5(): Int {
return get(4)
}
@@ -390,7 +390,7 @@ public inline fun IntArray.component5(): Int {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component5(): Long {
public inline operator fun LongArray.component5(): Long {
return get(4)
}
@@ -398,7 +398,7 @@ public inline fun LongArray.component5(): Long {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component5(): Short {
public inline operator fun ShortArray.component5(): Short {
return get(4)
}
@@ -406,77 +406,77 @@ public inline fun ShortArray.component5(): Short {
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component5(): T {
public inline operator fun <T> List<T>.component5(): T {
return get(4)
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun <T> Array<out T>.contains(element: T): Boolean {
public operator fun <T> Array<out T>.contains(element: T): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun BooleanArray.contains(element: Boolean): Boolean {
public operator fun BooleanArray.contains(element: Boolean): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun ByteArray.contains(element: Byte): Boolean {
public operator fun ByteArray.contains(element: Byte): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun CharArray.contains(element: Char): Boolean {
public operator fun CharArray.contains(element: Char): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun DoubleArray.contains(element: Double): Boolean {
public operator fun DoubleArray.contains(element: Double): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun FloatArray.contains(element: Float): Boolean {
public operator fun FloatArray.contains(element: Float): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun IntArray.contains(element: Int): Boolean {
public operator fun IntArray.contains(element: Int): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun LongArray.contains(element: Long): Boolean {
public operator fun LongArray.contains(element: Long): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun ShortArray.contains(element: Short): Boolean {
public operator fun ShortArray.contains(element: Short): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
public fun <T> Iterable<T>.contains(element: T): Boolean {
public operator fun <T> Iterable<T>.contains(element: T): Boolean {
if (this is Collection)
return contains(element)
return indexOf(element) >= 0
@@ -485,7 +485,7 @@ public fun <T> Iterable<T>.contains(element: T): Boolean {
/**
* Returns `true` if [element] is found in the collection.
*/
public fun <T> Sequence<T>.contains(element: T): Boolean {
public operator fun <T> Sequence<T>.contains(element: T): Boolean {
return indexOf(element) >= 0
}
+28 -28
View File
@@ -377,7 +377,7 @@ public fun <T, R, V> Sequence<T>.merge(sequence: Sequence<R>, transform: (T, R)
/**
* Returns a list containing all elements of the original collection except the elements contained in the given [array].
*/
public fun <T> Iterable<T>.minus(array: Array<out T>): List<T> {
public operator fun <T> Iterable<T>.minus(array: Array<out T>): List<T> {
if (array.isEmpty()) return this.toList()
val other = array.toHashSet()
return this.filterNot { it in other }
@@ -388,7 +388,7 @@ public fun <T> Iterable<T>.minus(array: Array<out T>): List<T> {
* Note that the source sequence and the array being subtracted are iterated only when an `iterator` is requested from
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
*/
public fun <T> Sequence<T>.minus(array: Array<out T>): Sequence<T> {
public operator fun <T> Sequence<T>.minus(array: Array<out T>): Sequence<T> {
if (array.isEmpty()) return this
return object: Sequence<T> {
override fun iterator(): Iterator<T> {
@@ -401,7 +401,7 @@ public fun <T> Sequence<T>.minus(array: Array<out T>): Sequence<T> {
/**
* Returns a set containing all elements of the original set except the elements contained in the given [array].
*/
public fun <T> Set<T>.minus(array: Array<out T>): Set<T> {
public operator fun <T> Set<T>.minus(array: Array<out T>): Set<T> {
val result = LinkedHashSet<T>(this)
result.removeAll(array)
return result
@@ -410,7 +410,7 @@ public fun <T> Set<T>.minus(array: Array<out T>): Set<T> {
/**
* Returns a list containing all elements of the original collection except the elements contained in the given [collection].
*/
public fun <T> Iterable<T>.minus(collection: Iterable<T>): List<T> {
public operator fun <T> Iterable<T>.minus(collection: Iterable<T>): List<T> {
val other = collection.convertToSetForSetOperationWith(this)
if (other.isEmpty())
return this.toList()
@@ -422,7 +422,7 @@ public fun <T> Iterable<T>.minus(collection: Iterable<T>): List<T> {
* Note that the source sequence and the collection being subtracted are iterated only when an `iterator` is requested from
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
*/
public fun <T> Sequence<T>.minus(collection: Iterable<T>): Sequence<T> {
public operator fun <T> Sequence<T>.minus(collection: Iterable<T>): Sequence<T> {
return object: Sequence<T> {
override fun iterator(): Iterator<T> {
val other = collection.convertToSetForSetOperation()
@@ -437,7 +437,7 @@ public fun <T> Sequence<T>.minus(collection: Iterable<T>): Sequence<T> {
/**
* Returns a set containing all elements of the original set except the elements contained in the given [collection].
*/
public fun <T> Set<T>.minus(collection: Iterable<T>): Set<T> {
public operator fun <T> Set<T>.minus(collection: Iterable<T>): Set<T> {
val other = collection.convertToSetForSetOperationWith(this)
if (other.isEmpty())
return this.toSet()
@@ -451,7 +451,7 @@ public fun <T> Set<T>.minus(collection: Iterable<T>): Set<T> {
/**
* Returns a list containing all elements of the original collection without the first occurrence of the given [element].
*/
public fun <T> Iterable<T>.minus(element: T): List<T> {
public operator fun <T> Iterable<T>.minus(element: T): List<T> {
val result = ArrayList<T>(collectionSizeOrDefault(10))
var removed = false
return this.filterTo(result) { if (!removed && it == element) { removed = true; false } else true }
@@ -460,7 +460,7 @@ public fun <T> Iterable<T>.minus(element: T): List<T> {
/**
* Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element].
*/
public fun <T> Sequence<T>.minus(element: T): Sequence<T> {
public operator fun <T> Sequence<T>.minus(element: T): Sequence<T> {
return object: Sequence<T> {
override fun iterator(): Iterator<T> {
var removed = false
@@ -472,7 +472,7 @@ public fun <T> Sequence<T>.minus(element: T): Sequence<T> {
/**
* Returns a set containing all elements of the original set except the given [element].
*/
public fun <T> Set<T>.minus(element: T): Set<T> {
public operator fun <T> Set<T>.minus(element: T): Set<T> {
val result = LinkedHashSet<T>(mapCapacity(size()))
var removed = false
return this.filterTo(result) { if (!removed && it == element) { removed = true; false } else true }
@@ -481,7 +481,7 @@ public fun <T> Set<T>.minus(element: T): Set<T> {
/**
* Returns a list containing all elements of the original collection except the elements contained in the given [sequence].
*/
public fun <T> Iterable<T>.minus(sequence: Sequence<T>): List<T> {
public operator fun <T> Iterable<T>.minus(sequence: Sequence<T>): List<T> {
val other = sequence.toHashSet()
if (other.isEmpty())
return this.toList()
@@ -493,7 +493,7 @@ public fun <T> Iterable<T>.minus(sequence: Sequence<T>): List<T> {
* Note that the source sequence and the sequence being subtracted are iterated only when an `iterator` is requested from
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
*/
public fun <T> Sequence<T>.minus(sequence: Sequence<T>): Sequence<T> {
public operator fun <T> Sequence<T>.minus(sequence: Sequence<T>): Sequence<T> {
return object: Sequence<T> {
override fun iterator(): Iterator<T> {
val other = sequence.toHashSet()
@@ -508,7 +508,7 @@ public fun <T> Sequence<T>.minus(sequence: Sequence<T>): Sequence<T> {
/**
* Returns a set containing all elements of the original set except the elements contained in the given [sequence].
*/
public fun <T> Set<T>.minus(sequence: Sequence<T>): Set<T> {
public operator fun <T> Set<T>.minus(sequence: Sequence<T>): Set<T> {
val result = LinkedHashSet<T>(this)
result.removeAll(sequence)
return result
@@ -733,7 +733,7 @@ public inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, S
/**
* Returns a list containing all elements of the original collection and then all elements of the given [array].
*/
public fun <T> Collection<T>.plus(array: Array<out T>): List<T> {
public operator fun <T> Collection<T>.plus(array: Array<out T>): List<T> {
val result = ArrayList<T>(this.size() + array.size())
result.addAll(this)
result.addAll(array)
@@ -743,7 +743,7 @@ public fun <T> Collection<T>.plus(array: Array<out T>): List<T> {
/**
* Returns a list containing all elements of the original collection and then all elements of the given [array].
*/
public fun <T> Iterable<T>.plus(array: Array<out T>): List<T> {
public operator fun <T> Iterable<T>.plus(array: Array<out T>): List<T> {
if (this is Collection) return this.plus(array)
val result = ArrayList<T>()
result.addAll(this)
@@ -756,14 +756,14 @@ public fun <T> Iterable<T>.plus(array: Array<out T>): List<T> {
* Note that the source sequence and the array being added are iterated only when an `iterator` is requested from
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
*/
public fun <T> Sequence<T>.plus(array: Array<out T>): Sequence<T> {
public operator fun <T> Sequence<T>.plus(array: Array<out T>): Sequence<T> {
return this.plus(array.asList())
}
/**
* Returns a set containing all elements both of the original set and the given [array].
*/
public fun <T> Set<T>.plus(array: Array<out T>): Set<T> {
public operator fun <T> Set<T>.plus(array: Array<out T>): Set<T> {
val result = LinkedHashSet<T>(mapCapacity(this.size() + array.size()))
result.addAll(this)
result.addAll(array)
@@ -773,7 +773,7 @@ public fun <T> Set<T>.plus(array: Array<out T>): Set<T> {
/**
* Returns a list containing all elements of the original collection and then all elements of the given [collection].
*/
public fun <T> Collection<T>.plus(collection: Iterable<T>): List<T> {
public operator fun <T> Collection<T>.plus(collection: Iterable<T>): List<T> {
if (collection is Collection) {
val result = ArrayList<T>(this.size() + collection.size())
result.addAll(this)
@@ -789,7 +789,7 @@ public fun <T> Collection<T>.plus(collection: Iterable<T>): List<T> {
/**
* Returns a list containing all elements of the original collection and then all elements of the given [collection].
*/
public fun <T> Iterable<T>.plus(collection: Iterable<T>): List<T> {
public operator fun <T> Iterable<T>.plus(collection: Iterable<T>): List<T> {
if (this is Collection) return this.plus(collection)
val result = ArrayList<T>()
result.addAll(this)
@@ -802,14 +802,14 @@ public fun <T> Iterable<T>.plus(collection: Iterable<T>): List<T> {
* Note that the source sequence and the collection being added are iterated only when an `iterator` is requested from
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
*/
public fun <T> Sequence<T>.plus(collection: Iterable<T>): Sequence<T> {
public operator fun <T> Sequence<T>.plus(collection: Iterable<T>): Sequence<T> {
return sequenceOf(this, collection.asSequence()).flatten()
}
/**
* Returns a set containing all elements both of the original set and the given [collection].
*/
public fun <T> Set<T>.plus(collection: Iterable<T>): Set<T> {
public operator fun <T> Set<T>.plus(collection: Iterable<T>): Set<T> {
val result = LinkedHashSet<T>(mapCapacity(collection.collectionSizeOrNull()?.let { this.size() + it } ?: this.size() * 2))
result.addAll(this)
result.addAll(collection)
@@ -819,7 +819,7 @@ public fun <T> Set<T>.plus(collection: Iterable<T>): Set<T> {
/**
* Returns a list containing all elements of the original collection and then the given [element].
*/
public fun <T> Collection<T>.plus(element: T): List<T> {
public operator fun <T> Collection<T>.plus(element: T): List<T> {
val result = ArrayList<T>(size() + 1)
result.addAll(this)
result.add(element)
@@ -829,7 +829,7 @@ public fun <T> Collection<T>.plus(element: T): List<T> {
/**
* Returns a list containing all elements of the original collection and then the given [element].
*/
public fun <T> Iterable<T>.plus(element: T): List<T> {
public operator fun <T> Iterable<T>.plus(element: T): List<T> {
if (this is Collection) return this.plus(element)
val result = ArrayList<T>()
result.addAll(this)
@@ -840,14 +840,14 @@ public fun <T> Iterable<T>.plus(element: T): List<T> {
/**
* Returns a sequence containing all elements of the original sequence and then the given [element].
*/
public fun <T> Sequence<T>.plus(element: T): Sequence<T> {
public operator fun <T> Sequence<T>.plus(element: T): Sequence<T> {
return sequenceOf(this, sequenceOf(element)).flatten()
}
/**
* Returns a set containing all elements of the original set and then the given [element].
*/
public fun <T> Set<T>.plus(element: T): Set<T> {
public operator fun <T> Set<T>.plus(element: T): Set<T> {
val result = LinkedHashSet<T>(mapCapacity(size() + 1))
result.addAll(this)
result.add(element)
@@ -857,7 +857,7 @@ public fun <T> Set<T>.plus(element: T): Set<T> {
/**
* Returns a list containing all elements of the original collection and then all elements of the given [sequence].
*/
public fun <T> Collection<T>.plus(sequence: Sequence<T>): List<T> {
public operator fun <T> Collection<T>.plus(sequence: Sequence<T>): List<T> {
val result = ArrayList<T>(this.size() + 10)
result.addAll(this)
result.addAll(sequence)
@@ -867,7 +867,7 @@ public fun <T> Collection<T>.plus(sequence: Sequence<T>): List<T> {
/**
* Returns a list containing all elements of the original collection and then all elements of the given [sequence].
*/
public fun <T> Iterable<T>.plus(sequence: Sequence<T>): List<T> {
public operator fun <T> Iterable<T>.plus(sequence: Sequence<T>): List<T> {
val result = ArrayList<T>()
result.addAll(this)
result.addAll(sequence)
@@ -879,14 +879,14 @@ public fun <T> Iterable<T>.plus(sequence: Sequence<T>): List<T> {
* Note that the source sequence and the sequence being added are iterated only when an `iterator` is requested from
* the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.
*/
public fun <T> Sequence<T>.plus(sequence: Sequence<T>): Sequence<T> {
public operator fun <T> Sequence<T>.plus(sequence: Sequence<T>): Sequence<T> {
return sequenceOf(this, sequence).flatten()
}
/**
* Returns a set containing all elements both of the original set and the given [sequence].
*/
public fun <T> Set<T>.plus(sequence: Sequence<T>): Set<T> {
public operator fun <T> Set<T>.plus(sequence: Sequence<T>): Set<T> {
val result = LinkedHashSet<T>(mapCapacity(this.size() * 2))
result.addAll(this)
result.addAll(sequence)
+42 -42
View File
@@ -14,7 +14,7 @@ import java.util.Collections // TODO: it's temporary while we have java.util.Col
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("intRangeContains")
public fun Range<Int>.contains(item: Byte): Boolean {
public operator fun Range<Int>.contains(item: Byte): Boolean {
return start <= item && item <= end
}
@@ -22,7 +22,7 @@ public fun Range<Int>.contains(item: Byte): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("longRangeContains")
public fun Range<Long>.contains(item: Byte): Boolean {
public operator fun Range<Long>.contains(item: Byte): Boolean {
return start <= item && item <= end
}
@@ -30,7 +30,7 @@ public fun Range<Long>.contains(item: Byte): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("shortRangeContains")
public fun Range<Short>.contains(item: Byte): Boolean {
public operator fun Range<Short>.contains(item: Byte): Boolean {
return start <= item && item <= end
}
@@ -38,7 +38,7 @@ public fun Range<Short>.contains(item: Byte): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("doubleRangeContains")
public fun Range<Double>.contains(item: Byte): Boolean {
public operator fun Range<Double>.contains(item: Byte): Boolean {
return start <= item && item <= end
}
@@ -46,42 +46,42 @@ public fun Range<Double>.contains(item: Byte): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("floatRangeContains")
public fun Range<Float>.contains(item: Byte): Boolean {
public operator fun Range<Float>.contains(item: Byte): Boolean {
return start <= item && item <= end
}
@Deprecated("The 'contains' operation for a range of Char and Byte item is not supported and should not be used.")
public fun CharRange.contains(item: Byte): Nothing {
public operator fun CharRange.contains(item: Byte): Nothing {
throw UnsupportedOperationException()
}
@Deprecated("The 'contains' operation for a range of Int and Char item is not supported and should not be used.")
public fun IntRange.contains(item: Char): Nothing {
public operator fun IntRange.contains(item: Char): Nothing {
throw UnsupportedOperationException()
}
@Deprecated("The 'contains' operation for a range of Long and Char item is not supported and should not be used.")
public fun LongRange.contains(item: Char): Nothing {
public operator fun LongRange.contains(item: Char): Nothing {
throw UnsupportedOperationException()
}
@Deprecated("The 'contains' operation for a range of Byte and Char item is not supported and should not be used.")
public fun ByteRange.contains(item: Char): Nothing {
public operator fun ByteRange.contains(item: Char): Nothing {
throw UnsupportedOperationException()
}
@Deprecated("The 'contains' operation for a range of Short and Char item is not supported and should not be used.")
public fun ShortRange.contains(item: Char): Nothing {
public operator fun ShortRange.contains(item: Char): Nothing {
throw UnsupportedOperationException()
}
@Deprecated("The 'contains' operation for a range of Double and Char item is not supported and should not be used.")
public fun DoubleRange.contains(item: Char): Nothing {
public operator fun DoubleRange.contains(item: Char): Nothing {
throw UnsupportedOperationException()
}
@Deprecated("The 'contains' operation for a range of Float and Char item is not supported and should not be used.")
public fun FloatRange.contains(item: Char): Nothing {
public operator fun FloatRange.contains(item: Char): Nothing {
throw UnsupportedOperationException()
}
@@ -89,7 +89,7 @@ public fun FloatRange.contains(item: Char): Nothing {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("intRangeContains")
public fun Range<Int>.contains(item: Double): Boolean {
public operator fun Range<Int>.contains(item: Double): Boolean {
return start <= item && item <= end
}
@@ -97,7 +97,7 @@ public fun Range<Int>.contains(item: Double): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("longRangeContains")
public fun Range<Long>.contains(item: Double): Boolean {
public operator fun Range<Long>.contains(item: Double): Boolean {
return start <= item && item <= end
}
@@ -105,7 +105,7 @@ public fun Range<Long>.contains(item: Double): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("byteRangeContains")
public fun Range<Byte>.contains(item: Double): Boolean {
public operator fun Range<Byte>.contains(item: Double): Boolean {
return start <= item && item <= end
}
@@ -113,7 +113,7 @@ public fun Range<Byte>.contains(item: Double): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("shortRangeContains")
public fun Range<Short>.contains(item: Double): Boolean {
public operator fun Range<Short>.contains(item: Double): Boolean {
return start <= item && item <= end
}
@@ -121,12 +121,12 @@ public fun Range<Short>.contains(item: Double): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("floatRangeContains")
public fun Range<Float>.contains(item: Double): Boolean {
public operator fun Range<Float>.contains(item: Double): Boolean {
return start <= item && item <= end
}
@Deprecated("The 'contains' operation for a range of Char and Double item is not supported and should not be used.")
public fun CharRange.contains(item: Double): Nothing {
public operator fun CharRange.contains(item: Double): Nothing {
throw UnsupportedOperationException()
}
@@ -134,7 +134,7 @@ public fun CharRange.contains(item: Double): Nothing {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("intRangeContains")
public fun Range<Int>.contains(item: Float): Boolean {
public operator fun Range<Int>.contains(item: Float): Boolean {
return start <= item && item <= end
}
@@ -142,7 +142,7 @@ public fun Range<Int>.contains(item: Float): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("longRangeContains")
public fun Range<Long>.contains(item: Float): Boolean {
public operator fun Range<Long>.contains(item: Float): Boolean {
return start <= item && item <= end
}
@@ -150,7 +150,7 @@ public fun Range<Long>.contains(item: Float): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("byteRangeContains")
public fun Range<Byte>.contains(item: Float): Boolean {
public operator fun Range<Byte>.contains(item: Float): Boolean {
return start <= item && item <= end
}
@@ -158,7 +158,7 @@ public fun Range<Byte>.contains(item: Float): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("shortRangeContains")
public fun Range<Short>.contains(item: Float): Boolean {
public operator fun Range<Short>.contains(item: Float): Boolean {
return start <= item && item <= end
}
@@ -166,12 +166,12 @@ public fun Range<Short>.contains(item: Float): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("doubleRangeContains")
public fun Range<Double>.contains(item: Float): Boolean {
public operator fun Range<Double>.contains(item: Float): Boolean {
return start <= item && item <= end
}
@Deprecated("The 'contains' operation for a range of Char and Float item is not supported and should not be used.")
public fun CharRange.contains(item: Float): Nothing {
public operator fun CharRange.contains(item: Float): Nothing {
throw UnsupportedOperationException()
}
@@ -179,7 +179,7 @@ public fun CharRange.contains(item: Float): Nothing {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("longRangeContains")
public fun Range<Long>.contains(item: Int): Boolean {
public operator fun Range<Long>.contains(item: Int): Boolean {
return start <= item && item <= end
}
@@ -187,7 +187,7 @@ public fun Range<Long>.contains(item: Int): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("byteRangeContains")
public fun Range<Byte>.contains(item: Int): Boolean {
public operator fun Range<Byte>.contains(item: Int): Boolean {
return start <= item && item <= end
}
@@ -195,7 +195,7 @@ public fun Range<Byte>.contains(item: Int): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("shortRangeContains")
public fun Range<Short>.contains(item: Int): Boolean {
public operator fun Range<Short>.contains(item: Int): Boolean {
return start <= item && item <= end
}
@@ -203,7 +203,7 @@ public fun Range<Short>.contains(item: Int): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("doubleRangeContains")
public fun Range<Double>.contains(item: Int): Boolean {
public operator fun Range<Double>.contains(item: Int): Boolean {
return start <= item && item <= end
}
@@ -211,12 +211,12 @@ public fun Range<Double>.contains(item: Int): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("floatRangeContains")
public fun Range<Float>.contains(item: Int): Boolean {
public operator fun Range<Float>.contains(item: Int): Boolean {
return start <= item && item <= end
}
@Deprecated("The 'contains' operation for a range of Char and Int item is not supported and should not be used.")
public fun CharRange.contains(item: Int): Nothing {
public operator fun CharRange.contains(item: Int): Nothing {
throw UnsupportedOperationException()
}
@@ -224,7 +224,7 @@ public fun CharRange.contains(item: Int): Nothing {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("intRangeContains")
public fun Range<Int>.contains(item: Long): Boolean {
public operator fun Range<Int>.contains(item: Long): Boolean {
return start <= item && item <= end
}
@@ -232,7 +232,7 @@ public fun Range<Int>.contains(item: Long): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("byteRangeContains")
public fun Range<Byte>.contains(item: Long): Boolean {
public operator fun Range<Byte>.contains(item: Long): Boolean {
return start <= item && item <= end
}
@@ -240,7 +240,7 @@ public fun Range<Byte>.contains(item: Long): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("shortRangeContains")
public fun Range<Short>.contains(item: Long): Boolean {
public operator fun Range<Short>.contains(item: Long): Boolean {
return start <= item && item <= end
}
@@ -248,7 +248,7 @@ public fun Range<Short>.contains(item: Long): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("doubleRangeContains")
public fun Range<Double>.contains(item: Long): Boolean {
public operator fun Range<Double>.contains(item: Long): Boolean {
return start <= item && item <= end
}
@@ -256,12 +256,12 @@ public fun Range<Double>.contains(item: Long): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("floatRangeContains")
public fun Range<Float>.contains(item: Long): Boolean {
public operator fun Range<Float>.contains(item: Long): Boolean {
return start <= item && item <= end
}
@Deprecated("The 'contains' operation for a range of Char and Long item is not supported and should not be used.")
public fun CharRange.contains(item: Long): Nothing {
public operator fun CharRange.contains(item: Long): Nothing {
throw UnsupportedOperationException()
}
@@ -269,7 +269,7 @@ public fun CharRange.contains(item: Long): Nothing {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("intRangeContains")
public fun Range<Int>.contains(item: Short): Boolean {
public operator fun Range<Int>.contains(item: Short): Boolean {
return start <= item && item <= end
}
@@ -277,7 +277,7 @@ public fun Range<Int>.contains(item: Short): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("longRangeContains")
public fun Range<Long>.contains(item: Short): Boolean {
public operator fun Range<Long>.contains(item: Short): Boolean {
return start <= item && item <= end
}
@@ -285,7 +285,7 @@ public fun Range<Long>.contains(item: Short): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("byteRangeContains")
public fun Range<Byte>.contains(item: Short): Boolean {
public operator fun Range<Byte>.contains(item: Short): Boolean {
return start <= item && item <= end
}
@@ -293,7 +293,7 @@ public fun Range<Byte>.contains(item: Short): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("doubleRangeContains")
public fun Range<Double>.contains(item: Short): Boolean {
public operator fun Range<Double>.contains(item: Short): Boolean {
return start <= item && item <= end
}
@@ -301,12 +301,12 @@ public fun Range<Double>.contains(item: Short): Boolean {
* Checks if the specified [item] belongs to this range.
*/
@kotlin.jvm.JvmName("floatRangeContains")
public fun Range<Float>.contains(item: Short): Boolean {
public operator fun Range<Float>.contains(item: Short): Boolean {
return start <= item && item <= end
}
@Deprecated("The 'contains' operation for a range of Char and Short item is not supported and should not be used.")
public fun CharRange.contains(item: Short): Nothing {
public operator fun CharRange.contains(item: Short): Nothing {
throw UnsupportedOperationException()
}
+27 -27
View File
@@ -569,7 +569,7 @@ public fun <C : MutableCollection<in R>, R> Sequence<*>.filterIsInstanceTo(desti
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun BooleanArray.plus(array: BooleanArray): BooleanArray {
public operator fun BooleanArray.plus(array: BooleanArray): BooleanArray {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -580,7 +580,7 @@ public fun BooleanArray.plus(array: BooleanArray): BooleanArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun ByteArray.plus(array: ByteArray): ByteArray {
public operator fun ByteArray.plus(array: ByteArray): ByteArray {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -591,7 +591,7 @@ public fun ByteArray.plus(array: ByteArray): ByteArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun CharArray.plus(array: CharArray): CharArray {
public operator fun CharArray.plus(array: CharArray): CharArray {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -602,7 +602,7 @@ public fun CharArray.plus(array: CharArray): CharArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun DoubleArray.plus(array: DoubleArray): DoubleArray {
public operator fun DoubleArray.plus(array: DoubleArray): DoubleArray {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -613,7 +613,7 @@ public fun DoubleArray.plus(array: DoubleArray): DoubleArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun FloatArray.plus(array: FloatArray): FloatArray {
public operator fun FloatArray.plus(array: FloatArray): FloatArray {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -624,7 +624,7 @@ public fun FloatArray.plus(array: FloatArray): FloatArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun IntArray.plus(array: IntArray): IntArray {
public operator fun IntArray.plus(array: IntArray): IntArray {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -635,7 +635,7 @@ public fun IntArray.plus(array: IntArray): IntArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun LongArray.plus(array: LongArray): LongArray {
public operator fun LongArray.plus(array: LongArray): LongArray {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -646,7 +646,7 @@ public fun LongArray.plus(array: LongArray): LongArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun ShortArray.plus(array: ShortArray): ShortArray {
public operator fun ShortArray.plus(array: ShortArray): ShortArray {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -657,7 +657,7 @@ public fun ShortArray.plus(array: ShortArray): ShortArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [array].
*/
public fun <T> Array<T>.plus(array: Array<out T>): Array<T> {
public operator fun <T> Array<T>.plus(array: Array<out T>): Array<T> {
val thisSize = size()
val arraySize = array.size()
val result = Arrays.copyOf(this, thisSize + arraySize)
@@ -668,7 +668,7 @@ public fun <T> Array<T>.plus(array: Array<out T>): Array<T> {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun BooleanArray.plus(collection: Collection<Boolean>): BooleanArray {
public operator fun BooleanArray.plus(collection: Collection<Boolean>): BooleanArray {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -678,7 +678,7 @@ public fun BooleanArray.plus(collection: Collection<Boolean>): BooleanArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun ByteArray.plus(collection: Collection<Byte>): ByteArray {
public operator fun ByteArray.plus(collection: Collection<Byte>): ByteArray {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -688,7 +688,7 @@ public fun ByteArray.plus(collection: Collection<Byte>): ByteArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun CharArray.plus(collection: Collection<Char>): CharArray {
public operator fun CharArray.plus(collection: Collection<Char>): CharArray {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -698,7 +698,7 @@ public fun CharArray.plus(collection: Collection<Char>): CharArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun DoubleArray.plus(collection: Collection<Double>): DoubleArray {
public operator fun DoubleArray.plus(collection: Collection<Double>): DoubleArray {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -708,7 +708,7 @@ public fun DoubleArray.plus(collection: Collection<Double>): DoubleArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun FloatArray.plus(collection: Collection<Float>): FloatArray {
public operator fun FloatArray.plus(collection: Collection<Float>): FloatArray {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -718,7 +718,7 @@ public fun FloatArray.plus(collection: Collection<Float>): FloatArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun IntArray.plus(collection: Collection<Int>): IntArray {
public operator fun IntArray.plus(collection: Collection<Int>): IntArray {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -728,7 +728,7 @@ public fun IntArray.plus(collection: Collection<Int>): IntArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun LongArray.plus(collection: Collection<Long>): LongArray {
public operator fun LongArray.plus(collection: Collection<Long>): LongArray {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -738,7 +738,7 @@ public fun LongArray.plus(collection: Collection<Long>): LongArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun ShortArray.plus(collection: Collection<Short>): ShortArray {
public operator fun ShortArray.plus(collection: Collection<Short>): ShortArray {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -748,7 +748,7 @@ public fun ShortArray.plus(collection: Collection<Short>): ShortArray {
/**
* Returns an array containing all elements of the original array and then all elements of the given [collection].
*/
public fun <T> Array<T>.plus(collection: Collection<T>): Array<T> {
public operator fun <T> Array<T>.plus(collection: Collection<T>): Array<T> {
var index = size()
val result = Arrays.copyOf(this, index + collection.size())
for (element in collection) result[index++] = element
@@ -758,7 +758,7 @@ public fun <T> Array<T>.plus(collection: Collection<T>): Array<T> {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun BooleanArray.plus(element: Boolean): BooleanArray {
public operator fun BooleanArray.plus(element: Boolean): BooleanArray {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element
@@ -768,7 +768,7 @@ public fun BooleanArray.plus(element: Boolean): BooleanArray {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun ByteArray.plus(element: Byte): ByteArray {
public operator fun ByteArray.plus(element: Byte): ByteArray {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element
@@ -778,7 +778,7 @@ public fun ByteArray.plus(element: Byte): ByteArray {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun CharArray.plus(element: Char): CharArray {
public operator fun CharArray.plus(element: Char): CharArray {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element
@@ -788,7 +788,7 @@ public fun CharArray.plus(element: Char): CharArray {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun DoubleArray.plus(element: Double): DoubleArray {
public operator fun DoubleArray.plus(element: Double): DoubleArray {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element
@@ -798,7 +798,7 @@ public fun DoubleArray.plus(element: Double): DoubleArray {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun FloatArray.plus(element: Float): FloatArray {
public operator fun FloatArray.plus(element: Float): FloatArray {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element
@@ -808,7 +808,7 @@ public fun FloatArray.plus(element: Float): FloatArray {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun IntArray.plus(element: Int): IntArray {
public operator fun IntArray.plus(element: Int): IntArray {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element
@@ -818,7 +818,7 @@ public fun IntArray.plus(element: Int): IntArray {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun LongArray.plus(element: Long): LongArray {
public operator fun LongArray.plus(element: Long): LongArray {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element
@@ -828,7 +828,7 @@ public fun LongArray.plus(element: Long): LongArray {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun ShortArray.plus(element: Short): ShortArray {
public operator fun ShortArray.plus(element: Short): ShortArray {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element
@@ -838,7 +838,7 @@ public fun ShortArray.plus(element: Short): ShortArray {
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
public fun <T> Array<T>.plus(element: T): Array<T> {
public operator fun <T> Array<T>.plus(element: T): Array<T> {
val index = size()
val result = Arrays.copyOf(this, index + 1)
result[index] = element