Java 8 is the biggest advance in the Java language since, well, Java 1, even bigger than the addition of generics in Java 5. I figured that every Java programmer would want to come up to speed quickly with these changes and wrote a short and snappy book “Java 8 for the Really Impatient”. A “rough cuts” version is now available on Safari.

In my French class, we are reading Marcel Pagnol’s “La gloire de mon père”. It never ceases to amaze me how much more complex and arbitrary human languages are compared to programming languages. Could you imagine a programming language with irregular verbs or the subjunctive mood?

As an aside, when I teach the introductory programming class, my students are aghast that they need to submit several programming homeworks per week. Clearly, they haven’t taken French. My French professors have routinely ruined my weekends with demands for written summaries of fifty+ page readings, or a couple hundred mind-numbing exercises on the subjunctive mood.

Back to topic, Marcel's dad claims that the longest word in the French language is “anticonstitutionnellement”. So, how would we verify this in Java?

In Linux, /usr/share/dict/french has French words from a to zygomatiques, one per line. So, let's read them and print the longest, using the latest features of Java 8:

Path path = Paths.get("/usr/share/dict/french");
try (Stream<String> lines = Files.lines(path)) {
   Optional<String> longest = lines.max(Comparator.comparingInt(String::length));

That’s certainly more concise than the traditional way:

Scanner in = new Scanner(new File("/usr/share/dict/french"), "UTF-8");
String longest = null;
while (in.hasNextLine()) {
   String line = in.nextLine();
   if (longest == null || longest.length() < line.length()) {
      longest = line;
if (longest != null) {

It is also just as efficient. The stream doesn't actually store all lines, but lazily fetches them when needed.

But there is a fair amount of new jargon to master.

So, how is one to pick up all that new jargon? I wanted a short book that covers everything that is new in Java 8, without also teaching me what I already know. No such book existed, so I had to write it.

If you or your company subscribes to Safari Books Online, check out the Rough Cut of “Java 8 for the Really Impatient”. In a short 200 pages, I cover lambdas, streams, concurrency, the new date/time API, Nashorn, Java FX, and more. No religion, just the facts, for experienced Java programmers, and organized for easy learning and easy reference. (In fact, I had to look up a couple of details from the book for writing the code in this blog. I had no trouble finding them :-))