Created
May 3, 2021 11:13
-
-
Save novoj/f02ea9509808a2d3a3912e4bbf2f8cf1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 book = "This represents contents of the book."; | |
final Function<String, IntSupplier> wordCounter = aString -> | |
() -> aString.split("\\s+").length; | |
final IntSupplier curry = wordCounter.apply(book); | |
int countBeforeChange = curry.getAsInt(); | |
book = "Book contents has been changed as of now."; | |
int countAfterChange = curry.getAsInt(); | |
System.out.print( | |
countBeforeChange == countAfterChange ? 1 : 0 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment