Java 8 in Action: Lambdas, Streams, and functional-style programming

By Raoul-Gabriel Urma, Mario Fusco, Alan Mycroft


Java eight in Action is a basically written consultant to the recent positive aspects of Java eight. The e-book covers lambdas, streams, and functional-style programming. With Java 8's sensible gains now you can write extra concise code in much less time, and likewise instantly make the most of multicore architectures. it is time to dig in!

Purchase of the print e-book contains a loose book in PDF, Kindle, and ePub codecs from Manning Publications.

About the Book

Every re-creation of Java is necessary, yet Java eight is a video game changer. Java eight in Action is a basically written advisor to the recent good points of Java eight. It starts with a realistic advent to lambdas, utilizing real-world Java code. subsequent, it covers the recent Streams API and exhibits how one can use it to make collection-based code greatly more uncomplicated to appreciate and retain. It additionally explains different significant Java eight beneficial properties together with default tools, not obligatory, CompletableFuture, and the recent Date and Time API.

This publication is written for programmers acquainted with Java and simple OO programming.

What's Inside

  • How to take advantage of Java 8's robust new features
  • Writing powerful multicore-ready applications
  • Refactoring, trying out, and debugging
  • Adopting functional-style programming
  • Quizzes and quick-check questions

About the Authors

Raoul-Gabriel Urma is a software program engineer, speaker, coach, and PhD candidate on the collage of Cambridge. Mario Fusco is an engineer at purple Hat and writer of the lambdaj library. Alan Mycroft is a professor at Cambridge and cofounder of the Raspberry Pi Foundation.

Table of Contents

  1. Java eight: why if you happen to care?
  2. Passing code with habit parameterization
  3. Lambda expressions
  5. Introducing streams
  6. Working with streams
  7. Collecting info with streams
  8. Parallel facts processing and performance
    PART three powerful JAVA eight PROGRAMMING
  9. Refactoring, checking out, and debugging
  10. Default methods
  11. utilizing not obligatory as a greater substitute to null
  12. CompletableFuture: composable asynchronousprogramming
  13. New Date and Time API
  14. PART four past JAVA 8
  15. Thinking functionally
  16. Functional programming techniques
  17. Blending OOP and FP: evaluating Java eight and Scala
  18. Conclusions and the place subsequent for Java
  20. Miscellaneous language updates
  21. Miscellaneous library updates
  22. Performing a number of operations in parallelon a stream
  23. Lambdas and JVM bytecode

Show description

Quick preview of Java 8 in Action: Lambdas, Streams, and functional-style programming PDF

Similar Technology books

Dictionary of Landscape Architecture and Construction

In an that includes the talents, services, and exertions of a wide-range of execs and employees, stable communications turn into an important, and a standard vocabulary is vital to winning tasks. some of the phrases utilized in panorama structure, land making plans, environmental making plans, and panorama building are unavailable, or so new, or industry-specific that they can’t be present in traditional dictionaries.

Principles of Electronic Communication Systems

Rules of digital verbal exchange platforms 3/e presents the main updated survey to be had for college students taking a primary direction in digital communications. Requiring basically easy algebra and trigonometry, the recent variation is impressive for its clarity, studying beneficial properties and various full-color images and illustrations.

Semiconductor Physics And Devices: Basic Principles

With its powerful pedagogy, better clarity, and thorough exam of the physics of semiconductor fabric, Semiconductor Physics and units, 4/e offers a foundation for realizing the features, operation, and boundaries of semiconductor units. Neamen's Semiconductor Physics and units bargains with houses and features of semiconductor fabrics and units.

The Oxford Handbook of Computer Music (Oxford Handbooks)

The Oxford instruction manual of laptop song deals a cutting-edge cross-section of the main field-defining themes and debates in computing device song this present day. a different contribution to the sphere, it situates computing device song within the extensive context of its production and function around the diversity of matters - from tune cognition to pedagogy to sociocultural issues - that form modern discourse within the box.

Additional info for Java 8 in Action: Lambdas, Streams, and functional-style programming

Show sample text content

For instance, let’s say you must filter out dear transactions from an inventory after which staff them through forex. You’d have to write loads of boilerplate code to enforce this knowledge processing question, as proven right here: additionally, it’s obscure at a look what the code does as a result of a number of nested control-flow statements. utilizing the Streams API, you could remedy this challenge as follows: Don’t fear approximately this code for now since it may well appear like a little magic. Chapters 4–7 are devoted to explaining easy methods to make feel of the Streams API. For now it’s worthy noticing that the Streams API offers a really various strategy to approach information compared to the Collections API. utilizing a set, you’re dealing with the new release approach your self. you must iterate via each one aspect one after the other utilizing a for-each loop after which approach the weather. We name this manner of iterating over information exterior generation. against this, utilizing the Streams API, you don’t 28 need to imagine by way of loops in any respect. the information processing occurs internally contained in the library. We name this concept inner new release. We get back to those rules in bankruptcy four. As a moment discomfort element of operating with collections, imagine for a moment approximately the way you might method the checklist of transactions in case you had an unlimited variety of them; how are you going to approach this massive checklist? A unmarried CPU wouldn’t be capable of technique this massive quantity of information, yet when you've got a multicore machine in your table. preferably, you’d prefer to percentage the paintings one of the diversified CPU cores on hand in your laptop to lessen the processing time. In concept, when you have 8 cores, they need to have the ability to technique your facts 8 occasions as quick as utilizing one middle simply because they paintings in parallel. [5] five This naming is unlucky in many ways. all the cores in a multicore chip is a full-fledged CPU. however the word “multicore CPU” has develop into universal, so middle is used to consult the person CPUs. Multicore All new machine and computing device pcs are multicore desktops. rather than a unmarried CPU, they've got 4 or 8 or extra CPUs (usually known as cores[5]). the matter is vintage Java application makes use of only a unmarried the sort of cores, and the facility of the others is wasted. equally, many businesses use computing clusters (computers attached including quick networks) in order to technique significant quantities of knowledge successfully. Java eight enables new programming kinds to raised make the most such pcs. Google’s seek engine is an instance of a section of code that’s too large to run on a unmarried desktop. It reads each web page on the net and creates an index, mapping each notice showing on any net web page again to each URL containing that be aware. Then, in the event you do a Google seek related to a number of phrases, software program can quick use this index to provide you a suite of web content containing these phrases. attempt to think the way you could code this set of rules in Java (even for a smaller index than Google’s you’d have to take advantage of all of the cores on your computer). 1. three. 1. Multithreading is hard the matter is that exploiting parallelism by way of writing multithreaded code (using the Threads API from earlier types of Java) is tough.

Download PDF sample

Rated 4.03 of 5 – based on 26 votes