Skip to content

Conversation

@Allex-Nik
Copy link
Collaborator

@Allex-Nik Allex-Nik commented Nov 6, 2025

Fixes #1279

Copy link
Collaborator

@AndreiKingsley AndreiKingsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!
Regarding overloads for GroupBy and Pivot - I'm working on a general KDoc system for these operations, so I'll be reworking them anyway in the future, so you can leave them as they are.

@AndreiKingsley AndreiKingsley self-requested a review November 7, 2025 14:19
* @throws [NoSuchElementException] if the [DataColumn] contains no element matching the [predicate]
* (including the case when the [DataColumn] is empty).
*/
public fun <T> DataColumn<T>.first(predicate: (T) -> Boolean): T = values.first(predicate)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason we do not make this function inline? last in the same case is inline (the same goes for DataColumn<T>.firstOrNull(predicate: (T) -> Boolean))

@Allex-Nik Allex-Nik force-pushed the first-firstOrNull-documentation-tests branch 2 times, most recently from 6e10c71 to 803c080 Compare November 27, 2025 17:09
@Allex-Nik Allex-Nik force-pushed the first-firstOrNull-documentation-tests branch from 803c080 to f3b0fb1 Compare November 27, 2025 22:54
@Allex-Nik Allex-Nik force-pushed the first-firstOrNull-documentation-tests branch from f3b0fb1 to eed2863 Compare November 28, 2025 16:00
/**
* Returns the first [row][DataRow] in this [DataFrame].
*
* @see [DataFrame.firstOrNull]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you actually need to provide receiver here?
Anyway, please, omit it. Just [firstOrNull] should work, but if not, please use
[firstOrNull][DataFrame.firstOrNull]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do it in all other place, please

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed it here: #1547 (comment)

@see [firstOrNull][DataFrame.firstOrNull] still leads to showing the whole thing: DataFrame.firstOrNull.

But I think we can also do it in this style:

 See [lastOrNull][DataFrame.lastOrNull],
 [first][DataFrame.first],
 [take][DataFrame.take],
 [takeLast][DataFrame.takeLast],
 [takeWhile][DataFrame.takeWhile]

It would look like here:
picture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add KDocs and missed tests for first and firstOrNull functions

6 participants