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
@@ -9927,6 +9927,8 @@ public 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 inline fun <T> Array<out T>.all(predicate: (T) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9935,6 +9937,8 @@ public 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 inline fun ByteArray.all(predicate: (Byte) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9943,6 +9947,8 @@ public inline fun ByteArray.all(predicate: (Byte) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun ShortArray.all(predicate: (Short) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9951,6 +9957,8 @@ public inline fun ShortArray.all(predicate: (Short) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun IntArray.all(predicate: (Int) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9959,6 +9967,8 @@ public inline fun IntArray.all(predicate: (Int) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun LongArray.all(predicate: (Long) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9967,6 +9977,8 @@ public inline fun LongArray.all(predicate: (Long) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun FloatArray.all(predicate: (Float) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9975,6 +9987,8 @@ public inline fun FloatArray.all(predicate: (Float) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun DoubleArray.all(predicate: (Double) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9983,6 +9997,8 @@ public inline fun DoubleArray.all(predicate: (Double) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun BooleanArray.all(predicate: (Boolean) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9991,6 +10007,8 @@ public inline fun BooleanArray.all(predicate: (Boolean) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if all elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun CharArray.all(predicate: (Char) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -9999,6 +10017,8 @@ public inline fun CharArray.all(predicate: (Char) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun <T> Array<out T>.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10006,6 +10026,8 @@ public fun <T> Array<out T>.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun ByteArray.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10013,6 +10035,8 @@ public fun ByteArray.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun ShortArray.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10020,6 +10044,8 @@ public fun ShortArray.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun IntArray.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10027,6 +10053,8 @@ public fun IntArray.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun LongArray.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10034,6 +10062,8 @@ public fun LongArray.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun FloatArray.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10041,6 +10071,8 @@ public fun FloatArray.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun DoubleArray.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10048,6 +10080,8 @@ public fun DoubleArray.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun BooleanArray.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10055,6 +10089,8 @@ public fun BooleanArray.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if array has at least one element.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun CharArray.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -10062,6 +10098,8 @@ public fun CharArray.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public inline fun <T> Array<out T>.any(predicate: (T) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -10070,6 +10108,8 @@ public 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 inline fun ByteArray.any(predicate: (Byte) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -10078,6 +10118,8 @@ public 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 inline fun ShortArray.any(predicate: (Short) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -10086,6 +10128,8 @@ public 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 inline fun IntArray.any(predicate: (Int) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -10094,6 +10138,8 @@ public 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 inline fun LongArray.any(predicate: (Long) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -10102,6 +10148,8 @@ public 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 inline fun FloatArray.any(predicate: (Float) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -10110,6 +10158,8 @@ public 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 inline fun DoubleArray.any(predicate: (Double) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -10118,6 +10168,8 @@ public 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 inline fun BooleanArray.any(predicate: (Boolean) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -10126,6 +10178,8 @@ public 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 inline fun CharArray.any(predicate: (Char) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -11744,6 +11798,8 @@ public fun CharArray.minWith(comparator: Comparator<in Char>): Char? {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun <T> Array<out T>.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11751,6 +11807,8 @@ public fun <T> Array<out T>.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun ByteArray.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11758,6 +11816,8 @@ public fun ByteArray.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun ShortArray.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11765,6 +11825,8 @@ public fun ShortArray.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun IntArray.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11772,6 +11834,8 @@ public fun IntArray.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun LongArray.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11779,6 +11843,8 @@ public fun LongArray.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun FloatArray.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11786,6 +11852,8 @@ public fun FloatArray.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun DoubleArray.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11793,6 +11861,8 @@ public fun DoubleArray.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun BooleanArray.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11800,6 +11870,8 @@ public fun BooleanArray.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if the array has no elements.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun CharArray.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -11807,6 +11879,8 @@ public fun CharArray.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun <T> Array<out T>.none(predicate: (T) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
@@ -11815,6 +11889,8 @@ public 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 inline fun ByteArray.none(predicate: (Byte) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
@@ -11823,6 +11899,8 @@ public inline fun ByteArray.none(predicate: (Byte) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun ShortArray.none(predicate: (Short) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
@@ -11831,6 +11909,8 @@ public inline fun ShortArray.none(predicate: (Short) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun IntArray.none(predicate: (Int) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
@@ -11839,6 +11919,8 @@ public inline fun IntArray.none(predicate: (Int) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun LongArray.none(predicate: (Long) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
@@ -11847,6 +11929,8 @@ public inline fun LongArray.none(predicate: (Long) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun FloatArray.none(predicate: (Float) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
@@ -11855,6 +11939,8 @@ public inline fun FloatArray.none(predicate: (Float) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun DoubleArray.none(predicate: (Double) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
@@ -11863,6 +11949,8 @@ public inline fun DoubleArray.none(predicate: (Double) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun BooleanArray.none(predicate: (Boolean) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
@@ -11871,6 +11959,8 @@ public inline fun BooleanArray.none(predicate: (Boolean) -> Boolean): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun CharArray.none(predicate: (Char) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
|
||||
@@ -1383,6 +1383,8 @@ public 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 inline fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean {
|
||||
if (this is Collection && isEmpty()) return true
|
||||
@@ -1392,6 +1394,8 @@ public 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 fun <T> Iterable<T>.any(): Boolean {
|
||||
if (this is Collection) return !isEmpty()
|
||||
@@ -1400,6 +1404,8 @@ public fun <T> Iterable<T>.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public inline fun <T> Iterable<T>.any(predicate: (T) -> Boolean): Boolean {
|
||||
if (this is Collection && isEmpty()) return false
|
||||
@@ -1679,6 +1685,8 @@ public 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 fun <T> Iterable<T>.none(): Boolean {
|
||||
if (this is Collection) return isEmpty()
|
||||
@@ -1687,6 +1695,8 @@ public fun <T> Iterable<T>.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no elements match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun <T> Iterable<T>.none(predicate: (T) -> Boolean): Boolean {
|
||||
if (this is Collection && isEmpty()) return true
|
||||
|
||||
@@ -86,6 +86,8 @@ public inline fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.mapTo(des
|
||||
|
||||
/**
|
||||
* Returns `true` if all entries match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun <K, V> Map<out K, V>.all(predicate: (Map.Entry<K, V>) -> Boolean): Boolean {
|
||||
if (isEmpty()) return true
|
||||
@@ -95,6 +97,8 @@ public inline fun <K, V> Map<out K, V>.all(predicate: (Map.Entry<K, V>) -> Boole
|
||||
|
||||
/**
|
||||
* Returns `true` if map has at least one entry.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.any
|
||||
*/
|
||||
public fun <K, V> Map<out K, V>.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -102,6 +106,8 @@ public 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 inline fun <K, V> Map<out K, V>.any(predicate: (Map.Entry<K, V>) -> Boolean): Boolean {
|
||||
if (isEmpty()) return false
|
||||
@@ -167,6 +173,8 @@ public fun <K, V> Map<out K, V>.minWith(comparator: Comparator<in Map.Entry<K, V
|
||||
|
||||
/**
|
||||
* Returns `true` if the map has no entries.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun <K, V> Map<out K, V>.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -174,6 +182,8 @@ public 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 inline fun <K, V> Map<out K, V>.none(predicate: (Map.Entry<K, V>) -> Boolean): Boolean {
|
||||
if (isEmpty()) return true
|
||||
|
||||
@@ -963,6 +963,8 @@ public 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_.
|
||||
*/
|
||||
@@ -973,6 +975,8 @@ public 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_.
|
||||
*/
|
||||
@@ -982,6 +986,8 @@ public 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_.
|
||||
*/
|
||||
@@ -1251,6 +1257,8 @@ public 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_.
|
||||
*/
|
||||
@@ -1260,6 +1268,8 @@ public 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_.
|
||||
*/
|
||||
|
||||
@@ -812,6 +812,8 @@ public fun CharSequence.withIndex(): Iterable<IndexedValue<Char>> {
|
||||
|
||||
/**
|
||||
* Returns `true` if all characters match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.all
|
||||
*/
|
||||
public inline fun CharSequence.all(predicate: (Char) -> Boolean): Boolean {
|
||||
for (element in this) if (!predicate(element)) return false
|
||||
@@ -820,6 +822,8 @@ public 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 fun CharSequence.any(): Boolean {
|
||||
return !isEmpty()
|
||||
@@ -827,6 +831,8 @@ public fun CharSequence.any(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one character matches the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.anyWithPredicate
|
||||
*/
|
||||
public inline fun CharSequence.any(predicate: (Char) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return true
|
||||
@@ -1007,6 +1013,8 @@ public fun CharSequence.minWith(comparator: Comparator<in Char>): Char? {
|
||||
|
||||
/**
|
||||
* Returns `true` if the char sequence has no characters.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.none
|
||||
*/
|
||||
public fun CharSequence.none(): Boolean {
|
||||
return isEmpty()
|
||||
@@ -1014,6 +1022,8 @@ public fun CharSequence.none(): Boolean {
|
||||
|
||||
/**
|
||||
* Returns `true` if no characters match the given [predicate].
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.noneWithPredicate
|
||||
*/
|
||||
public inline fun CharSequence.none(predicate: (Char) -> Boolean): Boolean {
|
||||
for (element in this) if (predicate(element)) return false
|
||||
|
||||
Reference in New Issue
Block a user