Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Compose Higher Order Functions with Collections #125

Open
radbobdad opened this issue Aug 19, 2024 · 0 comments
Open

Android Compose Higher Order Functions with Collections #125

radbobdad opened this issue Aug 19, 2024 · 0 comments

Comments

@radbobdad
Copy link

Name of the Codelab or Codelab URL
https://developer.android.com/codelabs/basic-android-kotlin-compose-higher-order-functions#6

Describe the problem
The description of the sortedBy function says "lets you specify a lambda that returns the property you'd like to sort by". This is incorrect.

In fact the specified lamba should return an expression, which will control the sort order.
This expression typically will be based on properties of the collection being sorted, but is not required to be.

The current description (and subsequent example) leads one to imagine reflection where the lambda returns the name of the property to sort by, which is of course not the case.

In which lesson and step of the codelab can this issue be found?
Step 7, paragraph 2.

How to reproduce?

  1. Add a property "factor" to the class Cookie of type Double
  2. Change sortedBy expression in main() to { it.price*it.factor }

Versions
N/A this is purely a Kotlin lesson

Additional information
Add any other context about the problem here.

codelab: basic-android-compose-training-add-scrollable-list

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

No branches or pull requests

1 participant