takeWhile

open fun <C> ColumnSet<C>.takeWhile(predicate: (ColumnWithPath<C>) -> Boolean): ColumnSet<C>

Take (Cols) While

This operation takes the first columns from this while they adhere to the predicate, stops as soon as it encounters one that does not, and collects the taken columns into a ColumnSet.

This function operates solely on columns at the top-level.

Any Access APIs can be used as receiver for these functions.

NOTE: To avoid ambiguity, takeWhile is called takeColsWhile when called on a String or ColumnPath resembling a ColumnGroup.

For more information: See take(Last)(Cols)(While) on the documentation website.

Check out: Grammar

Examples:

df.select{ cols{ "my" init.name}.takeWhile{ "my" init.name} }

df.select{ myColumnGroup.takeWhile{ it.any{ it == "Alice" } } }

df.select{ "myColumnGroup".takeColsWhile{ it.kind() == ColumnKind.Value} }

Examples for this overload:

df.select{ colsOf<String>().takeWhile{ it.any{ it == "Alice" } } }

df.select{ cols{ .. }.takeWhile{ it.name.startsWith("my") } }

See also:

  • take — takes a fixed number of first columns.

  • takeLast — takes a fixed number of last columns.

  • takeLastWhile — takes the last columns while a predicate holds.

  • dropWhile — drops the first columns while a predicate holds.

Return

A ColumnSet containing the first columns adhering to the predicate.

Parameters

predicate

The ColumnFilter to control which columns to take.


open fun ColumnsSelectionDsl<*>.takeWhile(predicate: (ColumnWithPath<*>) -> Boolean): ColumnSet<*>

Take (Cols) While

This operation takes the first columns from this while they adhere to the predicate, stops as soon as it encounters one that does not, and collects the taken columns into a ColumnSet.

This function operates solely on columns at the top-level.

Any Access APIs can be used as receiver for these functions.

NOTE: To avoid ambiguity, takeWhile is called takeColsWhile when called on a String or ColumnPath resembling a ColumnGroup.

For more information: See take(Last)(Cols)(While) on the documentation website.

Check out: Grammar

Examples:

df.select{ cols{ "my" init.name}.takeWhile{ "my" init.name} }

df.select{ myColumnGroup.takeWhile{ it.any{ it == "Alice" } } }

df.select{ "myColumnGroup".takeColsWhile{ it.kind() == ColumnKind.Value} }

Examples for this overload:

df.select{ takeWhile{ it.any{ it == "Alice" } } }

See also:

  • take — takes a fixed number of first columns.

  • takeLast — takes a fixed number of last columns.

  • takeLastWhile — takes the last columns while a predicate holds.

  • dropWhile — drops the first columns while a predicate holds.

Return

A ColumnSet containing the first columns adhering to the predicate.

Parameters

predicate

The ColumnFilter to control which columns to take.