Created
May 3, 2021 11:18
-
-
Save novoj/06409e76b0a2d1d2b887e528fe47682a 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
StringBuilder book = new StringBuilder("This represents contents of the book."); | |
final Function<StringBuilder, IntSupplier> wordCounter = aString -> | |
() -> aString.toString().split("\\s+").length; | |
final IntSupplier curry = wordCounter.apply(book); | |
int countBeforeChange = curry.getAsInt(); | |
book.setLength(0); | |
book.append("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