Java Closures and Lambda

Robert Fischer

  • 出版商: Apress
  • 出版日期: 2015-03-03
  • 售價: $1,860
  • 貴賓價: 9.5$1,767
  • 語言: 英文
  • 頁數: 220
  • 裝訂: Paperback
  • ISBN: 1430259981
  • ISBN-13: 9781430259985
  • 相關分類: Java 程式語言
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

Java Closures and Lambda introduces you to significant new changes to the Java language coming out of what is termed Project Lambda. These new changes make their debut in Java 8, and their highlight is the long-awaited support for lambda expressions in the Java language. You'll learn to write lambda expressions and use them to create functional interfaces and default methods for evolving APIs, among many other uses. The changes in Java 8 are significant. Syntax and usage of the language are changed considerably with the introduction of closures and lambda expressions. This book takes you through these important changes from introduction to mastery. Through a set of clear examples, you'll learn to refactor existing code to take advantage of the new language features. You'll learn what those features can do for you, and when they are best applied. You'll learn to design and write new code having these important new features in mind from the very beginning. Clearly explains the fantastic benefits resulting from Project Lambda Explains the syntax and IDE support for the new features Shows how to streamline your code by bringing some of the benefits of functional programming to the Java language Illustrates parallelism in closures through Stream and Spliterator objects Explains API evolution by adding methods to existing interfaces without breaking existing interface implementations, a technique addressing potential multiple inheritance issues What you'll learn Encapsulate key bits of logic into anonymous functions without the need for anonymous classes Define closures to be used as generators of comparison functions Define map, filter, and reduce functions that are useful in working with lists and other collections Trap and handle exceptions involving lambdas and closures, including the passing of exception-type parameters Anticipate and provide for concurrency so that your code successfully scales across multiple CPU co

商品描述(中文翻譯)

《Java Closures and Lambda》將帶您了解Java語言中來自所謂的Project Lambda的重要新變化。這些新變化在Java 8中首次亮相,其亮點是期待已久的lambda表達式支持。您將學會編寫lambda表達式,並利用它們創建功能介面和默認方法,以便於API的演進,以及許多其他用途。Java 8中的變化是顯著的。隨著closures和lambda表達式的引入,語言的語法和用法有了相當大的改變。本書將引導您從入門到精通這些重要變化。通過一系列清晰的範例,您將學會重構現有代碼,以利用新的語言特性。您將了解這些特性能為您帶來什麼,以及何時最佳應用它們。您將學會在編寫新代碼時,從一開始就考慮這些重要的新特性。

本書清楚地解釋了Project Lambda所帶來的巨大好處,說明了新特性的語法和IDE支持,展示了如何通過將函數式編程的一些好處引入Java語言來簡化代碼,通過Stream和Spliterator對象說明closures中的並行性,解釋了API的演進,通過向現有介面添加方法而不破壞現有介面實現的技術,解決潛在的多重繼承問題。

您將學到的內容包括:
- 將關鍵邏輯封裝到匿名函數中,而無需使用匿名類
- 定義closures作為比較函數的生成器
- 定義在處理列表和其他集合時有用的map、filter和reduce函數
- 捕獲和處理涉及lambda和closures的異常,包括傳遞異常類型參數
- 預測並考慮並發性,以便您的代碼能夠成功擴展到多個CPU核心上