Last active
December 9, 2020 11:33
Star
You must be signed in to star a gist
Java 15 Features
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
List<Merchant> findTopMerchants(List<Merchant> merchants, int month) { | |
// Local record | |
record MerchantSales(Merchant merchant, double sales) {} | |
return merchants.stream() | |
.map(merchant -> new MerchantSales(merchant, computeSales(merchant, month))) | |
.sorted((m1, m2) -> Double.compare(m2.sales(), m1.sales())) | |
.map(MerchantSales::merchant) | |
.collect(toList()); | |
} |
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
String html = "<html>\n" + | |
" <body>\n" + | |
" <p>Hello, world</p>\n" + | |
" </body>\n" + | |
"</html>\n"; |
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
record Point(int x, int y) { } |
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
String html = """ | |
<html> | |
<body> | |
<p>Hello, world</p> | |
</body> | |
</html> | |
"""; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment