Add samples for any, all and none
Rewrite samples to make them working on sample generator Move location of the class that contains samples of Aggregates.kt
This commit is contained in:
committed by
Ilya Gorbunov
parent
a2897a29b5
commit
4926b5a4c0
@@ -5611,136 +5611,190 @@ public expect infix fun CharArray.union(other: Iterable<Char>): Set<Char>
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun <T> Array<out T>.all(predicate: (T) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun ByteArray.all(predicate: (Byte) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun ShortArray.all(predicate: (Short) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun IntArray.all(predicate: (Int) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun LongArray.all(predicate: (Long) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun FloatArray.all(predicate: (Float) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun DoubleArray.all(predicate: (Double) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun BooleanArray.all(predicate: (Boolean) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun CharArray.all(predicate: (Char) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun <T> Array<out T>.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun ByteArray.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun ShortArray.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun IntArray.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun LongArray.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun FloatArray.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun DoubleArray.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun BooleanArray.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun CharArray.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun <T> Array<out T>.any(predicate: (T) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun ByteArray.any(predicate: (Byte) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun ShortArray.any(predicate: (Short) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun IntArray.any(predicate: (Int) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun LongArray.any(predicate: (Long) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun FloatArray.any(predicate: (Float) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun DoubleArray.any(predicate: (Double) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun BooleanArray.any(predicate: (Boolean) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun CharArray.any(predicate: (Char) -> Boolean): Boolean
|
||||
|
||||
@@ -6487,91 +6541,127 @@ public expect fun CharArray.minWith(comparator: Comparator<in Char>): Char?
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun <T> Array<out T>.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun ByteArray.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun ShortArray.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun IntArray.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun LongArray.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun FloatArray.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun DoubleArray.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun BooleanArray.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun CharArray.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun <T> Array<out T>.none(predicate: (T) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun ByteArray.none(predicate: (Byte) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun ShortArray.none(predicate: (Short) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun IntArray.none(predicate: (Int) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun LongArray.none(predicate: (Long) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun FloatArray.none(predicate: (Float) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun DoubleArray.none(predicate: (Double) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun BooleanArray.none(predicate: (Boolean) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun CharArray.none(predicate: (Char) -> Boolean): Boolean
|
||||
|
||||
|
||||
@@ -706,16 +706,22 @@ public expect infix fun <T> Iterable<T>.union(other: Iterable<T>): Set<T>
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if collection has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun <T> Iterable<T>.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun <T> Iterable<T>.any(predicate: (T) -> Boolean): Boolean
|
||||
|
||||
@@ -838,11 +844,15 @@ public expect fun <T> Iterable<T>.minWith(comparator: Comparator<in T>): T?
|
||||
|
||||
/**
|
||||
* Returns `true` if the collection has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun <T> Iterable<T>.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun <T> Iterable<T>.none(predicate: (T) -> Boolean): Boolean
|
||||
|
||||
|
||||
@@ -51,16 +51,22 @@ public expect inline fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.ma
|
||||
|
||||
/**
|
||||
* Returns `true` if all entries match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun <K, V> Map<out K, V>.all(predicate: (Map.Entry<K, V>) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if map has at least one entry.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun <K, V> Map<out K, V>.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one entry matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun <K, V> Map<out K, V>.any(predicate: (Map.Entry<K, V>) -> Boolean): Boolean
|
||||
|
||||
@@ -105,11 +111,15 @@ public expect fun <K, V> Map<out K, V>.minWith(comparator: Comparator<in Map.Ent
|
||||
|
||||
/**
|
||||
* Returns `true` if the map has no entries.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun <K, V> Map<out K, V>.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no entries match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun <K, V> Map<out K, V>.none(predicate: (Map.Entry<K, V>) -> Boolean): Boolean
|
||||
|
||||
|
||||
@@ -596,6 +596,8 @@ public expect fun <T> Sequence<T>.toMutableSet(): MutableSet<T>
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
@@ -603,6 +605,8 @@ public expect inline fun <T> Sequence<T>.all(predicate: (T) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if sequence has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
@@ -610,6 +614,8 @@ public expect fun <T> Sequence<T>.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
@@ -746,6 +752,8 @@ public expect fun <T> Sequence<T>.minWith(comparator: Comparator<in T>): T?
|
||||
|
||||
/**
|
||||
* Returns `true` if the sequence has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
@@ -753,6 +761,8 @@ public expect fun <T> Sequence<T>.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*
|
||||
* The operation is _terminal_.
|
||||
*/
|
||||
|
||||
@@ -494,16 +494,22 @@ public expect fun CharSequence.withIndex(): Iterable<IndexedValue<Char>>
|
||||
|
||||
/**
|
||||
* Returns `true` if all characters match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public expect inline fun CharSequence.all(predicate: (Char) -> Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if char sequence has at least one character.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public expect fun CharSequence.any(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one character matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public expect inline fun CharSequence.any(predicate: (Char) -> Boolean): Boolean
|
||||
|
||||
@@ -588,11 +594,15 @@ public expect fun CharSequence.minWith(comparator: Comparator<in Char>): Char?
|
||||
|
||||
/**
|
||||
* Returns `true` if the char sequence has no characters.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public expect fun CharSequence.none(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if no characters match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public expect inline fun CharSequence.none(predicate: (Char) -> Boolean): Boolean
|
||||
|
||||
|
||||
Reference in New Issue
Block a user