Skip to content

Instantly share code, notes, and snippets.

@hbcruoma
Last active November 4, 2016 21:52
Show Gist options
  • Save hbcruoma/c5a7e2058dd701d59f1f74c705e2c421 to your computer and use it in GitHub Desktop.
Save hbcruoma/c5a7e2058dd701d59f1f74c705e2c421 to your computer and use it in GitHub Desktop.
Järjestä oliolista oliomuuttujan arvon perusteella (int)
// sort ascending
Collections.sort(this.scores, (Score s1, Score s2) -> {
return Integer.compare(s1.getScore(), s2.getScore());
});
// reverse sort
Collections.sort(this.scores, (Score s1, Score s2) -> {
return Integer.compare(s2.getScore(), s1.getScore());
});
@hbcruoma
Copy link
Author

hbcruoma commented Nov 4, 2016

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