Skip to Content
Java クックブック、第 4 版
book

Java クックブック、第 4 版

by Ian F. Darwin
May 2025
Intermediate to advanced
638 pages
10h 22m
Japanese
O'Reilly Media, Inc.
Content preview from Java クックブック、第 4 版

付録A. Javaの昔と今

はじめにJavaは常に動いている

Javaは常に、開発者やライターにとって移り変わりの激しいターゲットである。私の商業トレーニング・プログラムでは、現在のJavaはおろか、古いリリースのJavaに追加された機能のいくつかをまだ知らない開発者に出会うことがある。この付録では、Javaの各主要リリースについて見ていく。Jon ByousのSun Microsystemsの記事 "Java Technology "を参照のこと:Javaの初期の歴史については、Jon Byousの記事 "Java Technology: The Early Years "を参照のこと。パーダーボルン大学のWebサイトでもコピーを発見できる。1

Java 8より前のリリースに関するHTMLは古い歴史とみなされ、私のWebサイトhttps://darwinsys.com/java/ancientHistory.html。

Java 8の新機能

Java 8の言語変更

Java 8の最大の新機能はラムダ式である。 クロージャ(ラムダ式)は、どのように実装するかについて10年間議論されてきたが、ついにJava 8で登場した。 このトピックは非常に膨大なため、本書では1章を割いている。

構造化タイプに注釈を付けられるようになった。

インタフェースのデフォルト・メソッドがサポートされ、インタフェースのすべての実装を壊すことなく機能を追加できるようになった。

Java 8 API の変更点

Java 8では、JSR-310から新しい日付/時刻APIが導入された。これは、時刻を扱うための、より一貫性のある賢明なクラスとルーチンのセットを提供する。第6章は新しいAPIを使うように完全に書き直され、新旧API間の様々な変換を示すレシピで終わっている。

Java 8では、クロージャ、Streams 、並列コレクションなどの関数型プログラミングテクニックが導入された。これについては第9章で説明する。Streams をサポートするために、ListMapSet などのインタフェースに新しいメソッドが追加された。これまでは、Java 1.1の時代からほとんど変わっていなかった。幸いなことに、Java 8の言語サポートでは、インタフェースにdefault メソッドタイプが追加されているため、これらのインタフェースのカスタム実装を変更する必要はない(IDEの設定を最新のコンパイラレベルに変更しておけば)。

default メソッドの動作の一例として、Iterable は、forEach() という新しいdefault メソッドを得て、次のようなコードを書くことができる:

myList.forEach(e -> /* do something with e here... */);

これについては「Iterable.forEachメソッド(Java 8)」で詳しく説明する

コードネームNashornと呼ばれる新しいJavaScript実装は、javax.scriptレシピ18.3を参照)から利用可能で、コマンドラインからも実行できる。

Javadoc(レシピ15.2を参照)がjavax.tools APIに拡張された。

例えば、javax.persistence.NamedQueries (複数形)は、javax.persistence.NamedQuery (単数形)アノテーションのリストの単なるコンテナである。アノテーションは繰り返すことができるので、ラッパーアノテーションを手作業でコーディングする必要がなくなる。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

最新の Java レシピ

最新の Java レシピ

Ken Kousen
Javaによる関数型プログラミング ―Java 8ラムダ式とStream

Javaによる関数型プログラミング ―Java 8ラムダ式とStream

Venkat Subramaniam, 株式会社プログラミングシステム社
MySQL クックブック、第 4 版

MySQL クックブック、第 4 版

Sveta Smirnova, Alkin Tezuysal

Publisher Resources

ISBN: 9798341650336