Skip to content

Instantly share code, notes, and snippets.

@mcupak
Created October 13, 2017 21:43
Show Gist options
  • Select an option

  • Save mcupak/b2977d3a918cc96c1197ea2b814b15d6 to your computer and use it in GitHub Desktop.

Select an option

Save mcupak/b2977d3a918cc96c1197ea2b814b15d6 to your computer and use it in GitHub Desktop.
jshell> import jdk.jshell.*
jshell> JShell js = JShell.create()
js ==> jdk.jshell.JShell@c8e4bb0
jshell> List<SnippetEvent> snippets = js.eval("1+1")
snippets ==> [SnippetEvent(snippet=Snippet:VariableKey($1)#1-1 ... ,causeSnippetnullvalue=2)]
jshell> snippets.stream().map(s -> s.value()).forEach(System.out::println)
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment