Modern Java In action, 2nd ed

所需积分/C币:16 2018-10-05 12:01:52 8.33MB PDF

Manning’s bestselling Java 8 book has been revised for Java 9 and Java 10! In Modern Java in Action, readers build on their existing Java language skills with the newest features and techniques. The release of Java 9 builds on what made Java 8 so exciting. In addition to Java 8’s lambdas and streams
Modern ava in action LLAMBDAS STREAMS FUNCTIONAL AND REACTIVE PROGRAMMING RAOUL-GABRIEL URMA MARIO FUSCO, AND ALAN MYCROFT MANNING SHELTER ISLAND For online information and ordering of this and other Manning books, please visit For more information, please contact Special Sales Department Manning Publications Co 20 Baldwin Road PO BoX 761 Shelter island. ny 11964 C2019 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 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: Kevin Harreld 20 Baldwin Road Technical development editor: Dennis Sellinger PO Box 761 Review editor: Aleksandar dragosavjevic Shelter island. ny 11964 Project manager: Deirdre hiam Copy editors: Heidi Ward and Kathy Simpson Proofreader: Carol shield Technical proofreader: Jean-Francois Morin Typesetter: Dennis Dalinnik Cover designer: Marija Tudor ISBN:9781617293566 Printed in the united states of americ 12345678910-DP-232221201918 brief contents PART 1 FUNDAMENTALS 1 Java, 9, 10, and 1l: what's happening? 3 Passing code with behavior parameterization 26 3 Lambda expressions 42 PART 2 FUNCTIONAL-STYLE DATA PROCESSING WITH STREAMS.79 4 Introducing streams 81 5 Working with streams 98 Collecting data with streams 184 7 Parallel data processing and performance 172 Part 3 EFFECTIVE PROGRAMMING WITH STREAMS AND LAMBDAS。。 199 8 Collection api enhancements 201 Refactoring, testing, and debugging 216 10 Domain-specific languages using lambdas 239 BRIEF CONTENTS PART 4 EVERYDAY JAVA 273 11 USing Optional as a better alternative to null 275 12 New Date and Time aPi 297 13 Default methods 314 14 The lava Module system 333 PART5 ENHANCED JAVA CONCURRENCY……355 15 Concepts behind CompletableFuture and reactive programming 357 16 Completable Future: composable asynchronous programming 387 17 Reactive programming 416 PART 6 FUNCTIONAL PROGRAMMING AND FUTURE JAVA EVOLUTION 18 Thinking functionally 445 19 Functional programming techniques 460 20 Blending OoP and FP: Comparing Java and Scala 485 21 Conclusions and where next for Java 500 contents preface xa acknowledgments xxi about the authors xxviii about the cover illustration xxx PART 1 FUNDAMENTALS .9.1 Java8,9,10, and 11: what's happening? 3 So, what's the big story? 3 1. 2 Why is Java still changing? 6 Java's place in the programming language ecosystem Stream processing 8 Passing code to methods with behavior parameterization 9 Parallelism and shared mutable data 10 Leeds to evolve 11 1. 3 Functions in Java 12 Methods and lambdas as first-class citizens 12 Passing code: an example 14 From passing methods to lambdas 16 4 Streams 17 Multithreading is difficult 19 CoNTENTS 5 Default methods and Java modules 21 1.6 Other good ideas from functional programming 28 Passing code with behavior parameterization 26 2.1 Coping with changing requirements 27 First attempt: filtering green apples 28 Second attempt parameterizing the color 28 Third attempt: filtering with every attribute you can think of 29 2.2 Behavior parameterization 30 Fourth attempt: filtering by abstract criteria 31 2.8 Tackling verbosity 35 Anonymous classes 36. Fifth attempt: using an anonymous class 36 Sixth attempt: using a lambda expression 37 Seventh attempt: abstracting over List type 38 2.4 Real-world examples 39 Sorting with a Comparator 39. Executing a block of code with runnable 40 Returning a result using Callable 40 GUI event handling 41 3 Lambda expressions 42 3.1 Lambdas in a nutshell 43 3.2 Where and how to use lambdas 46 Functional interface 46 Function descriptor 48 8.3 Putting lambdas into practice: the execute-around pattern 50 Step 1: Remember behavior parameterization 51 Step 2: Use a functional interface to pass behaviors 51 Step 3: Execute a behavior! 52. Step 4: Pass lambdas 52 3.4 USing functional interfaces 53 Predicate54· Consumer54· Function55 8.5 Type checking, type inference, and restrictions 59 Type checking 59 Same lambda, different functional interfaces 61 Type inference 63 Using local variables 63 3.6 Method references 64 In a nutshell 65 Constructor references 68 3.7 Putting lambdas and method references into practice 70 Step 1: Pass code 71 Step 2: Use an anonymous class 71 Step 3: Use lambda expressions 71 Step 4: Use method references 72 CONTENTS 8.8 Useful methods to compose lambda expressions 72 Composing Comparators 73 Composing Predicates 73 Composing Functions 74 8.9 Similar ideas from mathematics 76 Integration 76 Connecting to Java 8 lambdas 77 PART 2 FUNCTIONAL-STYLE DATA PROCESSING WITH STREAMS 00@。0。000000。0000000。0000000。000000。00000 79 4 Introducing streams 81 4.1 What are streams? 82 4.2 Getting started with streams 86 4.3 Streams vs collections 88 Traversable only once 90 External vs internal iteration 9 4. Stream operations 93 Intermediate operations 94 Terminal operations 95 Working with streams 95 4.5 Road map 96 Working with streams 98 5.1 Filtering 99 filtering with a predicate 99 Filtering unique elements 100 5.2 Slicing a stream 100 Slicing using a predicate 101. Truncating a stream 102 Shipping elements 103 5.8 Mapping 104 Applying a function to each element of a stream 104 Flattening streams 105 5. 4 Finding and matching 108 Checking to see if a predicate matches at least one element 108 Checking to see if a predicate matches all elements 109 Finding an element 109. Finding the first element 110 5.5 Reducing lll Summing the elements 111 Maximum and minimum 113 5.6 Putting it all into practice 117 The domain: Traders and Transactions 117 Solutions 118

试读 127P Modern Java In action, 2nd ed

评论 下载该资源后可以进行评论 1

weixin_41640702 不错哦,就是不能再编辑
  • 签到新秀

  • 分享宗师


关注 私信 TA的资源

    Modern Java In action, 2nd ed 16积分/C币 立即下载
    Modern Java In action, 2nd ed第1页
    Modern Java In action, 2nd ed第2页
    Modern Java In action, 2nd ed第3页
    Modern Java In action, 2nd ed第4页
    Modern Java In action, 2nd ed第5页
    Modern Java In action, 2nd ed第6页
    Modern Java In action, 2nd ed第7页
    Modern Java In action, 2nd ed第8页
    Modern Java In action, 2nd ed第9页
    Modern Java In action, 2nd ed第10页
    Modern Java In action, 2nd ed第11页
    Modern Java In action, 2nd ed第12页
    Modern Java In action, 2nd ed第13页
    Modern Java In action, 2nd ed第14页
    Modern Java In action, 2nd ed第15页
    Modern Java In action, 2nd ed第16页
    Modern Java In action, 2nd ed第17页
    Modern Java In action, 2nd ed第18页
    Modern Java In action, 2nd ed第19页
    Modern Java In action, 2nd ed第20页


    16积分/C币 立即下载 >