8155581: jshell tool: replace use of Option.get()
authorntv
Fri, 10 Jun 2016 11:11:52 +0000
changeset 38912 2ddd6171351e
parent 38911 48a00b5ee366
child 38913 5b15a5ed3b0d
8155581: jshell tool: replace use of Option.get() Reviewed-by: rfield
langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
--- 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");