--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Thu Jun 09 23:24:05 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Fri Jun 10 11:11:52 2016 +0000
@@ -1426,18 +1426,15 @@
live = false;
if (!replayableHistory.isEmpty()) {
// Prevent history overflow by calculating what will fit, starting
- // with must recent
+ // with most recent
int sepLen = RECORD_SEPARATOR.length();
int length = 0;
int first = replayableHistory.size();
while(length < Preferences.MAX_VALUE_LENGTH && --first >= 0) {
length += replayableHistory.get(first).length() + sepLen;
}
- String hist = replayableHistory
- .subList(first + 1, replayableHistory.size())
- .stream()
- .reduce( (a, b) -> a + RECORD_SEPARATOR + b)
- .get();
+ String hist = String.join(RECORD_SEPARATOR,
+ replayableHistory.subList(first + 1, replayableHistory.size()));
prefs.put(REPLAY_RESTORE_KEY, hist);
}
fluffmsg("jshell.msg.goodbye");