ebook img

Manning Java 8 in Action, Lambdas Streams and Functional-Style Programming PDF

424 Pages·2014·5.65 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Manning Java 8 in Action, Lambdas Streams and Functional-Style Programming

Lambdas, streams, and functional-style programming IN ACTION Raoul-Gabriel Urma Mario Fusco Alan Mycroft M A N N I N G Java 8 in Action Java 8 in Action Lambdas, streams, and functional-style programming RAOUL-GABRIEL URMA MARIO FUSCO ALAN MYCROFT MANNING SHELTER ISLAND For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email: [email protected] ©2015 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editor: Susan Conant 20 Baldwin Road Technical development editor Al Scherer PO Box 761 Copyeditor: Linda Recktenwald Shelter Island, NY 11964 Proofreader: Katie Tennant Typesetter: Dennis Dalinnik Cover designer: Maria Tudor ISBN: 9781617291999 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – EBM – 19 18 17 16 15 14 To our parents brief contents PART 1 FUNDAMENTALS ............................................................1 1 ■ Java 8: why should you care? 3 2 ■ Passing code with behavior parameterization 24 3 ■ Lambda expressions 39 PART 2 FUNCTIONAL-STYLE DATA PROCESSING.........................75 4 ■ Introducing streams 77 5 ■ Working with streams 92 6 ■ Collecting data with streams 123 7 ■ Parallel data processing and performance 158 PART 3 EFFECTIVE JAVA 8 PROGRAMMING..............................183 8 ■ Refactoring, testing, and debugging 185 9 ■ Default methods 207 10 ■ Using Optional as a better alternative to null 225 11 ■ CompletableFuture: composable asynchronous programming 245 12 ■ New Date and Time API 273 vii viii BRIEF CONTENTS PART 4 BEYOND JAVA 8 .........................................................289 13 ■ Thinking functionally 291 14 ■ Functional programming techniques 305 15 ■ Blending OOP and FP: comparing Java 8 and Scala 329 16 ■ Conclusions and where next for Java 344 APPENDIXES ............................................................................358 A ■ Miscellaneous language updates 358 B ■ Miscellaneous library updates 362 C ■ Performing multiple operations in parallel on a stream 370 D ■ Lambdas and JVM bytecode 379 contents preface xvii acknowledgments xix about this book xxi about the authors xxv about the cover illustration xxvii PART 1 FUNDAMENTALS.................................................1 1 Java 8: why should you care? 3 1.1 Why is Java still changing? 5 Java’s place in the programming language ecosystem 6 Stream processing 7 ■ Passing code to methods with behavior parameterization 9 ■ Parallelism and shared mutable data 9 ■ Java needs to evolve 10 1.2 Functions in Java 11 Methods and lambdas as first-class citizens 12 ■ Passing code: an example 13 ■ From passing methods to lambdas 15 1.3 Streams 16 Multithreading is difficult 17 1.4 Default methods 20 1.5 Other good ideas from functional programming 21 1.6 Summary 23 ix

Description:
Java 8 in Action. Lambdas, streams, and functional-style programming. RAOUL-GABRIEL URMA. MARIO FUSCO. ALAN MYCROFT. MANNING.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.