image

Contents

Foreword

Acknowledgments

Introduction

1 Taking Java to the Next Level

1.1 From External to Internal Iteration

1.1.1 Internal Iteration

1.1.2 The Command Pattern

1.1.3 Lambda Expressions

1.2 From Collections to Streams

1.3 From Sequential to Parallel

1.4 Composing Behaviors

1.5 Conclusion

2 The Basics of Java Lambda Expressions

2.1 What Is a Lambda Expression?

2.1.1 The Syntax of Lambdas

2.2 Lambdas vs. Anonymous Inner Classes

2.2.1 No Identity Crisis

2.2.2 Scoping Rules for Lambdas

2.3 Variable Capture

2.4 Functional Interfaces

2.5 Using Lambda Expressions

2.6 Method and Constructor References

2.6.1 Static Method References

2.6.2 Instance Method References

2.6.3 Constructor References

2.7 Type Checking

2.7.1 What Exactly Is a Function Type?

2.7.2 Matching a Function Type

2.8 Overload Resolution

2.8.1 Overloading with Lambda Expressions

2.8.2 Overloading with Method References

2.9 Conclusion

3 Introduction to Streams and Pipelines

3.1 Stream Fundamentals

3.1.1 Parallel-Ready Code

3.1.2 Primitive Streams

3.2 Anatomy of a Pipeline

3.2.1 Starting Pipelines

3.2.2 Transforming Pipelines

3.2.3 Non-interference

3.2.4 Ending Pipelines

3.3 Conclusion

4 Ending Streams: Collection and Reduction

4.1 Using Collectors

4.1.1 Stand-alone Predefined Collectors

4.1.2 Composing Collectors

4.1.3 Chaining Pipelines

4.1.4 Worked Example: Most Popular Topics

4.2 Anatomy of a Collector

4.2.1 Concurrent Collection

4.3 Writing a Collector

4.3.1 Finishers

4.3.2 Worked Example: Finding My Books

4.3.3 Rules for Collectors

4.4 Reduction

4.4.1 Reduction over Primitives

4.4.2 Reduction over Reference Streams

4.4.3 Composing Collectors with Reduction

4.5 Conclusion

5 Starting Streams: Sources and Spliterators

5.1 Creating Streams

5.2 Spliterators and Fork/Join

5.2.1 Streams from Spliterators

5.3 Exceptions

5.4 Worked Example: Recursive grep

5.5 Conclusion

6 Stream Performance

6.1 Microbenchmarking

6.1.1 Measuring a Dynamic Runtime

6.1.2 The Java Microbenchmarking Harness

6.1.3 Experimental Method

6.2 Choosing Execution Mode

6.3 Stream Characteristics

6.4 Ordering

6.5 Stateful and Stateless Operations

6.6 Boxing and Unboxing

6.7 Spliterator Performance

6.8 Collector Performance

6.8.1 Concurrent Map Merge

6.8.2 Performance Analysis: Point Grouping

6.8.3 Performance Analysis: Finding My Books

6.9 Conclusion

7 API Evolution with Default Methods

7.1 Using Default Methods

7.2 What Role for Abstract Classes?

7.3 Default Method Syntax

7.4 Default Methods and Inheritance

7.4.1 Compatibility Problems

7.5 Static Methods in Interfaces

7.5.1 Using Static Methods

7.6 Conclusion

Conclusion

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.240.119