Last active
November 4, 2016 21:52
-
-
Save hbcruoma/c5a7e2058dd701d59f1f74c705e2c421 to your computer and use it in GitHub Desktop.
Järjestä oliolista oliomuuttujan arvon perusteella (int)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tämä on Java-taikaa. Jos haluat tietää, miten se toimii, tutki vaikkapa näitä lähteitä: