Developer productivity isnt the only reason why lambda expressions have been added toJava; there are fundamental forces in our industry at work here as well.
Who Should Read This Book?
This book is aimed squarely at Java developers who already have core Java SEskills and want to get up to speed on the big changes in Java 8.
If youre interested in reading about lambda expressions and how theycan improve your lot as a professional developer, read on! I dontassume you know about lambda expressions themselves, or any of the corelibrary changes; instead, I introduce concepts, libraries, and techniquesfrom scratch.
Although I would love for every developer who has ever lived to go and buy thisbook, realistically, its not appropriate for everyone. If you dont know anyJava at all, this isnt the book for you. At the same time, though lambdaexpressions in Java are very well covered here, I dont explain howthey are used in any other languages.
I dont provide a basic introduction to the use of several facets of theJava SE, such as collections, anonymous inner classes, or the event handlingmechanism in Swing. I assume that you already know about all of these elements.
How to Read This Book
This book is written in an example-driven style: very soon after a concept isintroduced, youll see some code. Occasionally you mightsee something in the code that youre not 100% familar with. Dont worryitll be explained very soon afterward, frequently in the next paragraph.
This approach also lets you try out the ideas as you go along. In fact, at the end ofmost chapters there are further examples for you to practice on your own. Ihighly recommend that you try doing these katas as you get to the end of thechapter. Practice makes perfect, andas every pragmaticprogrammer knowsits really easy to fool yourself into thinking that youunderstand some code when in reality youve missed a detail.
Because the use of lambda expressions is all about abstracting complexity awayinto libraries, I introduce a bunch of common library niceties as I go along.Chapters cover the core language changes and also the improvedlibraries that JDK 8 brings.
The final three chapters are about applying functional programming in the wild.Ill talk about a few tricks that make testing and debugging code a biteasier in . These chaptersalso introduce third-party libraries, where relevant.
Its probably worth thinking of the opening four chapters as theintroductory materialthings that everyone will need to know touse Java 8 properly. The latter chapters are more complex, but they alsoteach you how to be a more complete programmer who can confidently use lambdaexpressions in your own designs. There are also exercises as you go along, andthe answers to these can be found on GitHub. If youpractice the exercises as you go along, youll soon master lambda expressions.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold
Shows commands or other text that should be typed literally by the user. Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Tip
This element signifies a tip or suggestion.
Note
This element signifies a general note.
Warning
This element indicates a warning or caution.
Using Code Examples
Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/RichardWarburton/java-8-lambdas-exercises.
This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless youre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: Java 8 Lambdas by Richard Warburton (OReilly). Copyright 2014 Richard Warburton, 978-1-449-37077-0.
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .
Safari Books Online
Note
Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the worlds leading authors in technology and business.
Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.