- Java 9 Programming Blueprints
- Jason Lee
- 134字
- 2021-07-02 18:56:27
REPL
One change that seems to excite a lot of people isn't a language change at all. It's the addition of a REPL (Read-Eval-Print-Loop), a fancy term for a language shell. In fact, the command for this new tool is jshell. This tool allows us to type or paste in Java code and get immediate feedback. For example, if we wanted to experiment with the Streams API discussed in the preceding section, we could do something like this:
$ jshell | Welcome to JShell -- Version 9-ea | For an introduction type: /help intro jshell> List<String> names = Arrays.asList(new String[]{"Tom", "Bill", "Xavier", "Sarah", "Adam"}); names ==> [Tom, Bill, Xavier, Sarah, Adam] jshell> names.stream().sorted().forEach(System.out::println); Adam Bill Sarah Tom Xavier
This is a very welcome addition that should help Java developers rapidly prototype and test their ideas.
推薦閱讀
- C++面向?qū)ο蟪绦蛟O(shè)計(jì)(第三版)
- iOS面試一戰(zhàn)到底
- Django:Web Development with Python
- PHP 編程從入門(mén)到實(shí)踐
- 人人都懂設(shè)計(jì)模式:從生活中領(lǐng)悟設(shè)計(jì)模式(Python實(shí)現(xiàn))
- KnockoutJS Starter
- Unity 2018 Shaders and Effects Cookbook
- 實(shí)戰(zhàn)Java高并發(fā)程序設(shè)計(jì)(第2版)
- Simulation for Data Science with R
- INSTANT LESS CSS Preprocessor How-to
- Zend Framework 2 Cookbook
- INSTANT Lift Web Applications How-to
- Mastering Data Analysis with R
- Python深度學(xué)習(xí)入門(mén):從零構(gòu)建CNN和RNN
- 移山之道:VSTS軟件開(kāi)發(fā)指南