Skip to content

Commit cde9eb8

Browse files
translating the function
1 parent 355b985 commit cde9eb8

File tree

1 file changed

+22
-22
lines changed
  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api

1 file changed

+22
-22
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/none.kt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver
88
import org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate
99
import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnListImpl
1010

11+
// region DataFrame
12+
13+
/**
14+
* Returns `true` if none of the rows in this [DataFrame] satisfies the given [predicate].
15+
*
16+
* {@include [org.jetbrains.kotlinx.dataframe.documentation.RowFilterDescription]}
17+
*
18+
* ### Example
19+
* ```kotlin
20+
* // Check if there is not any row where "age" is greater than 18
21+
* val hasNoAdults = df.none { age > 18 }
22+
* ```
23+
*
24+
* @param predicate A [RowFilter] lambda that takes a [DataRow] (as both `this` and `it`)
25+
* and returns `true` if none of the rows should be considered a match.
26+
* @return `true` if none of the rows satisfies the [predicate], `false` otherwise.
27+
* @see [DataFrame.any]
28+
*/
29+
public inline fun <T> DataFrame<T>.none(predicate: RowFilter<T>): Boolean = rows().none { predicate(it, it) }
30+
31+
// endregion
32+
1133
// region ColumnsSelectionDsl
1234

1335
/**
@@ -54,25 +76,3 @@ public interface NoneColumnsSelectionDsl {
5476
}
5577

5678
// endregion
57-
58-
// region DataFrame
59-
60-
/**
61-
* Returns `true` if none of the rows in this [DataFrame] satisfies the given [predicate].
62-
*
63-
* {@include [org.jetbrains.kotlinx.dataframe.documentation.RowFilterDescription]}
64-
*
65-
* ### Example
66-
* ```kotlin
67-
* // Check if there is not any row where "age" is greater than 18
68-
* val hasNoAdults = df.none { age > 18 }
69-
* ```
70-
*
71-
* @param predicate A [RowFilter] lambda that takes a [DataRow] (as both `this` and `it`)
72-
* and returns `true` if none of the rows should be considered a match.
73-
* @return `true` if none of the rows satisfies the [predicate], `false` otherwise.
74-
* @see [DataFrame.any]
75-
*/
76-
public inline fun <T> DataFrame<T>.none(predicate: RowFilter<T>): Boolean = rows().none { predicate(it, it) }
77-
78-
// endregion

0 commit comments

Comments
 (0)