SlideShare a Scribd company logo
1 of 195
Download to read offline
1
徹
底
解
説
!
Project Lambdaのすべて
2014/3/21 13:30-14:20
Java8Launch
吉田 真也(@bitter_fox)
return
2
Who are you?
● 吉田真也(@bitter_fox)
● 職業: 学生
– 立命館大学 情報理工学部 情報システム学科
– 二回生
– 立命館コンピュータクラブ(RCC) 執行委員長(代表)
● http://www.rcc.ritsumei.ac.jp/
3
HashTag
#JJUG
4
JavaSE8
5
JavaSE8
Revolution
6
JavaSE8
Revolution
JavaSE5以来
(2004年)
7
JavaSE8
Revolution
JavaSE5以来
(2004年)
10年
ぶり
8
JavaSE8
Project Lambda
Revolution
JavaSE5以来
(2004年)
10年
ぶり
9
Project Lambda
● 並列処理を容易に書ける様に増強
– ライブラリ
– 言語
● StreamAPI(!=IOStream)の導入
● ラムダ式の導入
10
Why Project Lambda?
11
マルチコアCPU
12
マルチコアCPU
● CPU(ハード)のパラダイムシフト
– クロック数はそのまま
コア(数)を増やす
– 並列処理
● ソフトウェアにもパラダイムシフト
● 並列プログラミングにしないと性能をフルに利用で
きない
– アムダールの法則
13
アムダールの法則
90% 10%
90%
80% 20%
80%
5
%
1コア
1コア
∞コア
4コア
逐次処理 並列処理
14
現代的なアーキテクチャ
少しでも多くの部分で並列処理
15
並列処理ライブラリの歴史
– java.lang.Thread
● 扱いが難しかった/大きな粒度
● JavaSE5(J2SE 5.0)
– Concurrency Utilities(java.util.concurrent.*)
● 簡単化/大きな粒度
● JavaSE7
– Fork/Join Framework
● 小さな粒度/やや難
16
プロジェクト発足当時(JavaSE6〜JavaSE7)
小さな粒度向けのライブラリが無かった
JavaSE7後
小さな粒度向けのライブラリがあるものの使いづらい
17
マルチコアCPUの
台頭
マルチコアCPUコアライブラリ
18
ライブラリでは不十分
new Runnable(){
public void run(){
// proc
}
}
● 処理を分けるだけで5行
● いくらライブラリが良くても・・・
● 言語的に解決する必要がある
19
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
20
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
21
ライブラリの増強
● 一度公開されたインターフェース
– 変更を加えにくい
– メソッド追加
● 具象クラスが追随する必要がある
– 実装の提供
22
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
defaultメソッド
23
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
defaultメソッド
stat. intf. メソッド
24
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
defaultメソッド
stat. intf. メソッド
ラムダ式・メソッド参照
25
処理の分離のイディオム
new Runnable() {
public void run() {
//
}
}
26
処理の分離のイディオム
new Runnable() {
public void run() {
//
}
}
実装するべきメソッドが一つ
インターフェース
27
● 実装するべきメソッド(抽象メソッド)が一つ
● インターフェース
– java.lang.Runnable
– java.lang.Callable
– java.nio.file.PathMatcher
– java.awt.event.ActionListener
– java.swing.event.ChangeListner
– ...
28
関数型インターフェース
● 実装するべきメソッド(抽象メソッド)が一つ
● インターフェース
– java.lang.Runnable
– java.lang.Callable
– java.nio.file.PathMatcher
– java.awt.event.ActionListener
– java.swing.event.ChangeListner
– ...
29
関数型インターフェース
● 処理を分けるのに十分
● ライブラリの多くで利用されている
● 実装&インスタンス化する構文としてラムダ式
– 匿名クラスに代わる構文
30
関数型インターフェース?
interface F {
void f();
}
31
関数型インターフェース?
interface F {
void f();
}
● Yes!
32
関数型インターフェース?
interface F {
boolean equals(Object o);
}
33
関数型インターフェース?
interface F {
boolean equals(Object o);
}
● No!
● equalsはObjectクラスで定義されている
– インターフェースにおいて暗黙的なメソッド
抽象メソッドは0個
34
関数型インターフェース?
interface F {
Object clone();
}
35
関数型インターフェース?
interface F {
Object clone();
}
● Yes!
● cloneもObjectクラスで宣言されているが
protected
– Fではpublicで再宣言されている
36
関数型インターフェース(JLS9.8)
A functional interface is an interface that has just one abstract method, and thus represents a single function contract. (In some cases, this "single" method may take the form of multiple
abstract methods with override-equivalent signatures (8.4.2) inherited from superinterfaces; in this case, the inherited methods logically represent a single method.)
More precisely, for interface I, let M be the set of abstract methods that are members of I but that do not have the same signature as any public instance method of the class Object. Then I is
a functional interface if there exists a method m in M for which the following conditions hold:
The signature of m is a subsignature (8.4.2) of every method's signature in M.
m is return-type-substitutable (8.4.5) for every method in M.
In addition to the usual process of creating an interface instance by declaring (8.1) and instantiating (15.9) a class, instances of functional interfaces can be created with lambda expressions
(15.27), method references (15.28), or constructor references.
The function descriptor of a functional interface I is a method type (8.2) that can be used to legally override (8.4.8) the abstract method(s) of I.
Let M be the set of abstract methods defined above for I. The descriptor of I consists of the following:
Type parameters, formal parameters, and return types: Let m be a method in M with i) a signature that is a subsignature of every method's signature in M and ii) a return type that is a
subtype of every method's return type in M (after adapting for any type parameters (8.4.4)); if no such method exists, then let m be a method in M that i) has a signature that is a subsignature
of every method's signature in M and ii) is return-type-substitutable for every method in M. Then the descriptor's type parameters, formal parameter types, and return type are as given by m.
Thrown types: The descriptor's thrown types are derived from the throws clauses of the methods in M. If the descriptor is generic, these clauses are first adapted to the type parameters of
the descriptor (8.4.4); if the descriptor is not generic but at least one method in M is, these clauses are first erased. Then the descriptor's thrown types include every type, E, satisfying the
following constraints:
E is mentioned in one of the throws clauses.
For each throws clause, E is a subtype of some type named in that clause.
A functional interface type is one of the following:
A functional interface
A parameterization (4.5) of a functional interface
An intersection (4.9) of interface types that meets the following criteria:
Exactly one element of the intersection is a functional interface, or a parameterization of a functional interface. Let F be this interface.
A notional interface, I, that extends all the interfaces in the intersection would be a functional interface. If any of the intersection elements is a parameterized type, then I is generic: for
each element of the intersection that is a parameterized type J<A1...An>, let P1...Pn be the type parameters of J; then P1...Pn are also type parameters of I, and I extends the type
J<P1...Pn>.
The function descriptor of I is the same as the function descriptor of F.
The function descriptor of a parameterized functional interface, F<A1...An>, where A1...An are type arguments (4.5.1), is derived as follows. Let P1...Pn be the type parameters of F; types
T1...Tn are derived from the type arguments according to the following rules (for 1 ≤ i ≤ n):
If Ai is a type, then Ti = Ai.
If Ai is a upper-bounded wildcard ? extends Ui, then Ti = Ui.
If Ai is a lower-bounded wildcard ? super Li, then Ti = Li.
If Ai is an unbound wildcard ?, then if Pi has upper bound Bi that mentions none of P1...Pn, then Ti = Bi; otherwise, Ti = Object.
If F<T1...Tn> is a well-formed type, then the descriptor of F<A1...An> is the result of applying substitution [P1:=T1, ..., Pn:=Tn] to the descriptor of interface F. Otherwise, the descriptor of
F<A1...An> is undefined.
The function descriptor of an intersection that is a functional interface type is the same as the function descriptor of the functional interface or parameterization of a functional interface that is
an element of the intersection.
37
関数型インターフェース(JLS9.8)
A functional interface is an interface that has just one abstract method, and thus represents a single function contract. (In some cases, this "single" method may take the form of multiple
abstract methods with override-equivalent signatures (8.4.2) inherited from superinterfaces; in this case, the inherited methods logically represent a single method.)
More precisely, for interface I, let M be the set of abstract methods that are members of I but that do not have the same signature as any public instance method of the class Object. Then I is
a functional interface if there exists a method m in M for which the following conditions hold:
The signature of m is a subsignature (8.4.2) of every method's signature in M.
m is return-type-substitutable (8.4.5) for every method in M.
In addition to the usual process of creating an interface instance by declaring (8.1) and instantiating (15.9) a class, instances of functional interfaces can be created with lambda expressions
(15.27), method references (15.28), or constructor references.
The function descriptor of a functional interface I is a method type (8.2) that can be used to legally override (8.4.8) the abstract method(s) of I.
Let M be the set of abstract methods defined above for I. The descriptor of I consists of the following:
Type parameters, formal parameters, and return types: Let m be a method in M with i) a signature that is a subsignature of every method's signature in M and ii) a return type that is a
subtype of every method's return type in M (after adapting for any type parameters (8.4.4)); if no such method exists, then let m be a method in M that i) has a signature that is a subsignature
of every method's signature in M and ii) is return-type-substitutable for every method in M. Then the descriptor's type parameters, formal parameter types, and return type are as given by m.
Thrown types: The descriptor's thrown types are derived from the throws clauses of the methods in M. If the descriptor is generic, these clauses are first adapted to the type parameters of
the descriptor (8.4.4); if the descriptor is not generic but at least one method in M is, these clauses are first erased. Then the descriptor's thrown types include every type, E, satisfying the
following constraints:
E is mentioned in one of the throws clauses.
For each throws clause, E is a subtype of some type named in that clause.
A functional interface type is one of the following:
A functional interface
A parameterization (4.5) of a functional interface
An intersection (4.9) of interface types that meets the following criteria:
Exactly one element of the intersection is a functional interface, or a parameterization of a functional interface. Let F be this interface.
A notional interface, I, that extends all the interfaces in the intersection would be a functional interface. If any of the intersection elements is a parameterized type, then I is generic: for
each element of the intersection that is a parameterized type J<A1...An>, let P1...Pn be the type parameters of J; then P1...Pn are also type parameters of I, and I extends the type
J<P1...Pn>.
The function descriptor of I is the same as the function descriptor of F.
The function descriptor of a parameterized functional interface, F<A1...An>, where A1...An are type arguments (4.5.1), is derived as follows. Let P1...Pn be the type parameters of F; types
T1...Tn are derived from the type arguments according to the following rules (for 1 ≤ i ≤ n):
If Ai is a type, then Ti = Ai.
If Ai is a upper-bounded wildcard ? extends Ui, then Ti = Ui.
If Ai is a lower-bounded wildcard ? super Li, then Ti = Li.
If Ai is an unbound wildcard ?, then if Pi has upper bound Bi that mentions none of P1...Pn, then Ti = Bi; otherwise, Ti = Object.
If F<T1...Tn> is a well-formed type, then the descriptor of F<A1...An> is the result of applying substitution [P1:=T1, ..., Pn:=Tn] to the descriptor of interface F. Otherwise, the descriptor of
F<A1...An> is undefined.
The function descriptor of an intersection that is a functional interface type is the same as the function descriptor of the functional interface or parameterization of a functional interface that is
an element of the intersection.
@
FunctionalInterface
38
@FunctionalInterface
● 関数型インターフェースかどうか検査する
– コンパイル時
@FunctionalInterface
interface F {
boolean equals(Object o);
}
39
@FunctionalInterface
● 関数型インターフェースかどうか検査する
– コンパイル時
@FunctionalInterface
interface F {
boolean equals(Object o);
} @FunctionalInterface
^
Fは機能インタフェースではありません
インタフェース Fで抽象メソッドが見つかりません
エラー1個
40
匿名クラスからラムダ式へ
this.addActionListener(
new ActionListener(){
public void actionPerformed(
ActionEvent ae) {
//
}
})
41
匿名クラスからラムダ式へ
this.addActionListener(
new ActionListener(){
public void actionPerformed(
ActionEvent ae) {
//
}
})
addActionListenerの引
数から推論できる
42
匿名クラスからラムダ式へ
this.addActionListener(
new ActionListener(){
public void actionPerformed(
ActionEvent ae) {
//
}
})
実装するべきメソッド
も一意に定まる
43
ラムダ式
this.addActionListener(
(ActionEvent ae) -> {
//
})
● (仮引数) -> {メソッド本体}
● (int n1, int n2) -> {return n1+n2;}
44
ラムダ式
● 関数型インターフェースをインスタンス化
● (仮引数) -> {メソッド本体}
– 型推論で型が決まる
● 関数型インターフェースのインスタンスが
予期される場面で利用可
– ターゲット型
45
ターゲット型が曖昧な場合
Object o = () -> {};
● () -> {}の型として
– Objectが予期される
– 関数型インターフェースが予期されない
– 何を実装したらいいのかわからない
46
ターゲット型が曖昧な場合
Object o = (Runnable)() -> {};
– キャストを用いる
– Runnableが予期される
– 実装するべきインターフェースが分かる
47
ラムダ式の引数
this.addActionListener(
(ActionEvent ae) -> {
//
})
48
ラムダ式の引数
this.addActionListener(
(ActionEvent ae) -> {
//
})
引数の型も一意に定ま
る
49
ラムダ式の引数
this.addActionListener(
(ae) -> {
//
})
● 引数の型も省略可
● (n1, n2) -> {return n1+n2;}
50
ラムダ式の引数
this.addActionListener(
(ae) -> {
//
})
引数が一つで型が推論される
場合の()は不要
51
ラムダ式の引数
this.addActionListener(
ae -> {
//
})
● 引数が一つで型が省略される場合()不要
● n1 -> {return n1+5;}
52
ラムダ式の引数と_
● ラムダ式の引数としての_はコンパイルエラー
this.addActionListener( _ -> {/**/} );
– 他の言語での_は特殊な意味
– 混乱を招かないように利用不可に
– 将来の利用を見据え予約語に
● それ以外の_は警告に
53
ラムダ式のメソッド本体
(int n) -> {return n + 5;}
(n) -> {return n + 5;}
n -> {return n + 5;}
54
ラムダ式のメソッド本体
(int n) -> {return n + 5;}
(n) -> {return n + 5;}
n -> {return n + 5;}
● return文のみ場合,return等を省略できる
(int n) -> n + 5
(n) -> n + 5
n -> n + 5
55
ラムダ式のメソッド本体
(ActionEvent ae) -> {apply(ae);}
(ae) -> {apply(ae);}
ae -> {apply(ae);}
56
ラムダ式のメソッド本体
(ActionEvent ae) -> {apply(ae);}
(ae) -> {apply(ae);}
ae -> {apply(ae);}
● 戻り値がvoidでも,{;}を省略できる場合がある
(ActionEvent ae) -> apply(ae)
(ae) -> apply(ae)
ae -> apply(ae)
57
ラムダ式==匿名クラス?
● 違います!
– 匿名クラスのシンタックスシュガーではない
● 意味論も実装方法(OpenJDKの場合)も異なる
– 主にスコーピング規則
– 同じ部分もある
58
ラムダ式のスコーピング規則
1.ラムダ式内では外のスコープを引き継ぐ
2.常にアウタークラスのインスタンスを保持しない
– 匿名クラスなどとは大きく違う
3.ローカル変数の参照はfinalな変数のみ
– 匿名クラスと同様
– 注:実質的にfinal(後ほど説明)
59
1.外のスコープを引き継ぐ
class Main {
void method() {
Runnable r = () ->
System.out.println(this);
}
}
60
1.外のスコープを引き継ぐ
class Main {
void method() {
Runnable r = () ->
System.out.println(this);
}
}
● ラムダ式内のthis=エンクロージングクラス
61
1.外のスコープを引き継ぐ
class Main {
void method(int n) {
Runnable r = () -> {int n;};
}
}
62
1.外のスコープを引き継ぐ
class Main {
void method(int n) {
Runnable r = () -> {int n;};
}
}
● 多重定義
● コンパイルエラー
63
1.外のスコープを引き継ぐ
class Main {
void method(int n) {
Function<Integer, Integer> f =
n -> n + 5;
}
}
● 多重定義
● コンパイルエラー
64
2.アウタークラスへの参照
● 匿名クラス
– 常に保持
– メモリリークの危険性高
● ラムダ式
– 必要に応じて保持
65
2.アウタークラスへの参照
class Register {
void register(Processer p) {
p.add(new Func() {
public int f(int n) {return n * n;}
});
}
}
66
2.アウタークラスへの参照
class Register {
void register(Processer p) {
p.add(new Func() {
public int f(int n) {return n * n;}
});
}
}
Registerのインスタンスへの参照が残るRegisterのインスタンスへの参照が残る
67
2.アウタークラスへの参照
class Register {
void register(Processer p) {
p.add(n -> n * n);
}
}
68
2.アウタークラスへの参照
class Register {
void register(Processer p) {
p.add(n -> n * n);
}
}
Registerのインスタンスは保持しない
69
3.ローカル変数の参照
● 匿名クラスと同様
– finalな変数(実質的にfinal(後述)含む)
– 値の変更不可
70
ラムダ式の利用例
p -> p.getName()
s -> Integer.parseInt(s)
o -> list.add(o)
init -> new MyClass(init)
n -> new int[n]
● 引数を受け流すパターン
71
ラムダ式の利用例
p -> p.getName()
s -> Integer.parseInt(s)
o -> list.add(o)
init -> new MyClass(init)
n -> new int[n]
● 引数を受け流すパターン
● メソッド・コンストラクタ参照
72
メソッド・コンストラクタ参照
p -> p.getName()
s -> Integer.parseInt(s)
o -> list.add(o)
init -> new MyClass(init)
n -> new int[n]
● クラス名等::メソッド or new
Person::getName
Integer::perseInt
list::add
MyClass::new
int[]::new
73
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
defaultメソッド
stat. intf. メソッド
74
実質的にfinal(Effectively final)
● 匿名クラスやラムダ式で
実質的にfinalな変数への参照が可能に
– コンパイラがfinal性を推論
● 実質的にfinalな変数
– final修飾されていない変数
– final修飾されてもエラーにならない変数
75
実質的にfinalの例
void method(final int n) {
final String str = “HelloFinal”
Runnable r = new Runnable() {
public void run() {
System.out.println(str + n);
}};
}
76
実質的にfinalの例
void method(int n) {
String str = “HelloEffectivelyFinal”
Runnable r = new Runnable() {
public void run() {
System.out.println(str + n);
}};
}
77
実質的にfinalの例
void method(int n) {
String str = “HelloEffectivelyFinal”
Runnable r = () ->
System.out.println(str + n);
}
78
実質的にfinalでない例
void method(int n) {
Runnable r = () ->
System.out.println(n);
n = 5;
}
ラムダ式から参照されるローカル変数は、
finalまたは事実上のfinalである必要があります
Runnable r = () -> System.out.println(n);
79
実質的にfinalでない例
void method(int n) {
Runnable r = () -> n++;
}
ラムダ式から参照されるローカル変数は、
finalまたは事実上のfinalである必要があります
Runnable r = () -> n++;
80
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
複合型キャスト
defaultメソッド
stat. intf. メソッド
81
型推論の強化
● ターゲット型推論の強化
1.適用可能箇所の拡大
2.より正確な推論
82
ターゲット型推論?
● ターゲット型に基づく型推論
● JavaSE5(5.0)から存在
– メソッドジェネリクスの実型引数
– ダイアモンド演算子(JavaSE7)
83
ターゲット型
● ある式の型として予期される型のこと
● T t = expr;
– exprのターゲット型はT
84
ターゲット型が存在する文脈
● 変数宣言・・・ int n = …
● 割り当て・・・ n = …
● return文・・・ return …
● 配列初期化子・・・new String[]{...}
● 実引数・・・method(...)
● 条件式 ?:・・・bool ? … : …
● キャスト式 ・・・(Target)...
● ラムダ式の本体・・・() -> …
例 exprのターゲット型
変数宣言 int n = expr 変数の型(int)
割り当て n = expr 変数の型(nの型)
return文 return expr 戻り値の型
配列初期化子 new String[]{expr, ...} 配列の型(String)
実引数 m(expr, ...) 仮引数の型
条件式 cond ? expr : expr 透過された型
キャスト式 (String)expr String
ラムダ式の本体 () -> expr 戻り値の型
85
JavaSE7における適用可能箇所
メソッドジェネリクスの
実型引数
ダイアモンド演算子
変数宣言 ○ ○
割り当て ○ ○
return文 ○ ○
配列初期化子 ○ -
実引数 × ×
条件式 × ×
キャスト式 ○ ×
ラムダ式の本体
86
適用可能箇所の例(JavaSE7)
List<Integer> l = new ArrayList<>();
new ArrayList<T>()
new ArrayList<Integer>()
●
ArrayList<T> <: List<Integer>
– T =:= Integer
87
適用不可能箇所の例(JavaSE7)
● 実引数におけるターゲット型推論
printStrings(new ArrayList<>());
– void printStrings(List<String> l)
88
適用不可能箇所の例(JavaSE7)
● 実引数におけるターゲット型推論
printStrings(new ArrayList<Object>());
– void printStrings(List<String> l)
● コンパイルエラー
– Objectと推論される
89
適用不可能箇所の例(JavaSE7)
● 条件式におけるターゲット型推論
List<Integer> list = bool ?
Collections.emptyList() :
new ArrayList<>();
90
適用不可能箇所の例(JavaSE7)
● 条件式におけるターゲット型推論
List<Integer> list = bool ?
Collections.<Object>emptyList() :
new ArrayList<Object>();
● コンパイルエラー
– Objectと推論される
91
JavaSE8における適用可能箇所
メソッドジェネリクスの
実型引数
ダイアモンド演算子
変数宣言 ○ ○
割り当て ○ ○
return文 ○ ○
配列初期化子 ○ -
実引数 ○ ○
条件式 ○ ○
キャスト式 ○ ×?bug?(3/19現在)
ラムダ式の本体 ○ ○
92
適用可能になった例(JavaSE8)
● 実引数におけるターゲット型推論
printStrings(new ArrayList<>());
– void printStrings(List<String> l)
93
適用可能になった例(JavaSE8)
● 実引数におけるターゲット型推論
printStrings(new ArrayList<String>());
– void printStrings(List<String> l)
● 推論器が正しく働く
– ターゲット型よりStringと推論される
94
適用可能になった例(JavaSE8)
● 条件式におけるターゲット型推論
List<Integer> list = bool ?
Collections.emptyList() :
new ArrayList<>();
95
適用可能になった例(JavaSE8)
● 条件式におけるターゲット型推論
List<Integer> list = bool ?
Collections.<Integer>emptyList() :
new ArrayList<Integer>();
● 推論器が正しく働く
– ターゲット型よりIntegerと推論される
96
JavaSE8における適用可能箇所
ラムダ式・メソッド参照
変数宣言 ○
割り当て ○
return文 ○
配列初期化子 ○
実引数 ○
条件式 ○
キャスト式 ○
ラムダ式の本体 ○
97
2.より正確な推論
● 今までは簡易的な推論
● しばしば不正確な推論によりコンパイルエラー
– 複雑な場合
98
JavaSE7以前の推論
1.実引数の式の型を優先
2.実引数がない場合はターゲット型
99
ターゲット型推論が働く例
List<Number> list =
Arrays.asList();
java.util.Arrays#<T> List<T> asList(T...)
●
List<Number> =:= List<T>
– T =:= Number
100
不正確な推論の例(JavaSE7)
List<Number> list =
Arrays.asList(2, 5.5);
java.util.Arrays#<T> List<T> asList(T...)
101
不正確な推論の例(JavaSE7)
List<Number> list =
Arrays.<T>asList(2, 5.5);
●
T<:Object, T :>Integer,T:>Double(実引数より)
– T=:=Number & Comparable<...>
102
不正確な推論の例(JavaSE7)
List<Number> list =
Arrays.<Number & Comparable<...>>asList(2, 5.5);
● コンパイルエラー
– Number & Comparable<? extends Number &
Comparable<?>>と推論される
– List<Number & Comparable<...>>を
List<Number>として代入
103
JavaSE8以降の推論
● 実引数の型とターゲット型を加味
– グラフ推論
– より正確な型推論へ
104
先の例(JavaSE8の場合)
List<Number> list =
Arrays.asList(2, 5.5);
105
先の例(JavaSE8の場合)
List<Number> list =
Arrays.<T>asList(2, 5.5);
●
T<:Object, T :>Integer,T:>Double(実引数より)
●
T=Number(ターゲット型より)
– T=Number
106
先の例(JavaSE8の場合)
List<Number> list =
Arrays.<Number>asList(2, 5.5);
● 正しく推論器が働く
– Numberと推論される
107
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
defaultメソッド
stat. intf. メソッド
108
型キャスト
キャスト式に交差型を
109
交差型?
● Intersection Type
● JavaSE5(5.0)から存在
– ジェネリクスの型境界(@型仮引数)
– <T extends Runnable & Cloneable>
● RunnableとCloneableを継承する任意の型T
● 型 & 型 & … & 型
– 一つ目は参照型
– 二つ目以降はインターフェース
110
交差型キャスト
● (型 & 型 & … & 型)式
● 主にラムダ式・メソッド参照と使用する
111
もしも交差型キャストがなかったら
● SerializableでRunnableなインターフェース
– 関数型インターフェース
– ラムダ式でインスタンス化したい
– インターフェースを定義する必要がある
112
もしも交差型キャストがなかったら
interface SRunnable implements
Runnable, Serializeable {}
sendRunnable((SRunnable) () -> {/* */});
113
もしも交差型キャストがなかったら
interface SRunnable implements
Runnable, Serializeable {}
sendRunnable((SRunnable) () -> {/* */});
114
交差型キャスト+ラムダ式
sendRunnable((Runnable & Serializable)
() -> {/* */});
● 型合成される
115
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
defaultメソッド
stat. intf. メソッド
116
<interface>
PublishedInterface
+already()
+exist()
+methods()
117
<interface>
PublishedInterface
+already()
+exist()
+methods()
ReferenceImpl
+already()
+exist()
+methods()
AnotherImpl
+already()
+exist()
+methods()
UserImpl
+already()
+exist()
+methods()
118
<interface>
PublishedInterface
+already()
+exist()
+methods()
+newMethod()
ReferenceImpl
+already()
+exist()
+methods()
AnotherImpl
+already()
+exist()
+methods()
UserImpl
+already()
+exist()
+methods()
119
<interface>
PublishedInterface
+already()
+exist()
+methods()
+newMethod()
ReferenceImpl
+already()
+exist()
+methods()
AnotherImpl
+already()
+exist()
+methods()
UserImpl
+already()
+exist()
+methods()
120
インターフェースに拡張性を
● 新しいメソッドを加えても互換性を保つ
● デフォルトメソッド
– デフォルトの実装を提供する
– インターフェースに実装
– 実装が提供されない場合に使用される
121
デフォルトメソッド
interface Person {
Sex getSex();
default boolean isMan() {
return getSex() == Sex.MAN;
}
}
122
デフォルトメソッド
class PersonImpl implements Person {
public Sex getSex() {/*...*/}
// isManへの実装はなくてもOK
// Person#isManが使われる
}
123
デフォルトメソッド
class PersonImpl implements Person {
public Sex getSex() {/*...*/}
public boolean isMan() {/*...*/}
}
● オーバーライド可
124
デフォルトメソッド
● default修飾子
● publicメソッドとなる
– 既存のインターフェースメソッドと同様
● strictfp修飾のみ可
● 具象クラスで実装が提供されなくても無問題
● 拡張性を実現できた
– 新たな問題が・・・
125
実装の多重継承問題
126
多重継承
class BasicPerson {
public boolean isMan() {/*...*/}
}
class ComplexPerson extends BasicPerson
implements Person {
public Sex getSex() {/*...*/}
}
127
多重継承
BasicPerson
#isMan
Person
#isMan
ComplexPerson
#isMan
128
“Class always win”
129
クラスで定義された実装が
常に勝つ
130
Class always win
class BasicPerson {
public boolean isMan() {/*...*/}
}
class ComplexPerson extends BasicPerson implements
Person {
public Sex getSex() {/*...*/}
}
● BasicPerson#isManが使われる
– “Class always win”
131
親インターフェースの呼び出し
class ComplexPerson extends BasicPerson
implements Person {
public Sex getSex() {/*...*/}
public boolean isMan() {
return Person.super.isMan();
}
}
● インターフェース名.super.メソッド名(...)
132
クラスを介さない多重継承
interface Base1 {default void m() {}}
133
クラスを介さない多重継承
interface Base1 {default void m() {}}
interface Base2 {default void m() {}}
134
クラスを介さない多重継承
interface Base1 {default void m() {}}
interface Base2 {default void m() {}}
interface ExBase extends Base1, Base2 {}
135
多重継承
Base1#m Base2#m
ExBase#m
136
クラスを介さない多重継承
interface ExBase extends
Base1, Base2 {}
● コンパイルエラー
– オーバーライドして選択
137
クラスを介さない多重継承
interface ExBase extends
Base1, Base2 {
default void m() {
Base1.super.m();
}
}
144
多重継承は怖くない!!
● 大原則1:Class always win
– クラスで定義された実装が常に勝つ
● 大原則2:いつでもオーバーライドできる
– 親クラスでfinal修飾されてたら別
– インターフェースの実装を呼べる
145
Objectメソッドのデフォルトメソッド
● Objectで定義されたpublicメソッド
– そもそもデフォルトの実装
● Objectのpublicメソッドのデフォルトメソッドは不可
– interface I {default String toString() {/* */}}
– コンパイルエラー
147
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
defaultメソッド
stat. intf. メソッド
148
staticインターフェースメソッド
● staticなインターフェースメソッド
● 常にpublic修飾
– 他のインターフェースのメソッドと同様
● strictfp修飾可
– デフォルト実装と同様
149
staticインターフェースメソッドの例
interface Example {
static void method() {/* */}
}
150
staticインターフェースメソッドの例
interface Example {
static strictfp void method() {/* */}
}
● strictfp修飾可
151
staticインターフェースメソッドの継承
● 継承されない
– クラスメソッドと大きく違う
interface Example2 extends Example {}
Example2.method()はコンパイルエラー
152
Interesting Example
● publicでstaticなメソッド
– 人生で最初に書いたメソッド
153
Interesting Example
● publicでstaticなメソッド
– 人生で最初に書いたメソッド
public static void main(
String[] args)
154
main in Interface
interface EntryPoint {
public static void main(String[] args) {
/* ... */
}
}
● 正しく動く
155
マルチコアCPUコアライブラリ
ラムダ式・メソッド参照
実質的にfinal
型推論の強化
交差型キャスト
defaultメソッド
stat. intf. メソッド
156
Library Enhancements
StreamAPI
IO/NIOJCF
Optional
And
More...
157
Library Enhancements
StreamAPI
IO/NIOJCF
Optional
And
More...
158
No more 外部イテレーション
● 外部イテレーションは並列化困難
● 内部イテレーションベースのライブラリへ
– 並列化が容易に
159
外部イテレーション
● イテレーションが外にさらされている
– for,while文
for (Student s : students) {
}
160
内部イテレーションライブラリ
StreamAPI
161
StreamAPI
● java.util.stream.
Stream/IntStream/LongStream/DoubleStream
– ソースから生成される
– 中間操作と終端操作でデータを弄る
– 並列化が容易
162
Collection
配列
BufferReader
etc...
Stream
IntStream
LongStream
DoubleStream
中間操作
終端操作
j.u.stream.*Source
163
Collection
配列
BufferReader
etc...
Stream
IntStream
LongStream
DoubleStream
中間操作
終端操作
j.u.stream.*Source
164
Make Streams
ソース メソッド 使用例
Collection Collection#stream list.stream()
配列 Arrays#stream Arrays.stream(args)
BufferedReader BufferedReader#lines br.lines()
n〜m-1までの数値 IntStream#range IntStream.range(n, m)
n〜mまでの数値 IntStream#rangeClosed IntStream.rangeClosed(n, m)
任意の要素 Stream#of Stream.of(“J”, “a”, “v”, “a”)
165
Collection
配列
BufferReader
etc...
Stream
IntStream
LongStream
DoubleStream
中間操作
終端操作
j.u.stream.*Source
166
java.util.stream.
StreamAPI 要素の型
Stream<T> T(参照型)
IntStream int(プリミティブ型)
LongStream long(プリミティブ型)
DoubleStream double(プリミティブ型)
168
2 types of Stream
Sequential Stream
Parallel Stream
169
Change the type of Stream
Sequential Stream
Parallel Stream
parallel() sequential()
170
Collection
配列
BufferReader
etc...
Stream
IntStream
LongStream
DoubleStream
中間操作
終端操作
j.u.stream.*Source
171
中間操作?
● filterやmapなど
– Streamを返すメソッド
● 終端操作が行われるまで処理されない
– 遅延される
172
主要な中間操作
メソッド名 概要 使用例
filter フィルタリング s.filter(n -> n % 2 == 0)
map 写像・変換 s.map(p -> p.getName())
flatMap 写像・変換&平坦化 s.flatMap(room -> room.getPersons().stream())
distinct 同一の要素を除外 s.distinct()
sorted 並び替え s.sorted((p1, p2) -> compare(p1.age, p2.age))
peek
デバッグ向け
forEach
s.peek(e -> System.out.println(e))
limit 要素数制限 s.limit(5)
skip 読み飛ばす s.skip(5)
173
Collection
配列
BufferReader
etc...
Stream
IntStream
LongStream
DoubleStream
非終端操作
終端操作
j.u.stream.*Source
174
終端操作?
● forEachやreduceやcollectなど
– Streamを返さないメソッド
● 遅延されていた中間操作を確定
175
主要な終端操作
メソッド名 概要 使用例
forEach 反復処理 s.forEach(e -> System.out.println(e))
reduce 畳み込み演算 s.reduce(1, (n1, n2) -> n1 * n2)
collect 集約化 s.collect(Collectors.toList())
toArray 配列化 s.toArray(String[]::new)
min/max 最小値/最大値 s.min(String::compareToIgnoreCase)
count 要素数 s.count()
176
0から10まで出力したい
for (int i = 0; i <= 10; i++) {
System.out.println(i);
}
177
forEach[終端操作]
T->void[j.u.function.Consumer<T>#void accept(T)]
● forEach(T -> void)
– 各要素に引数で渡した処理を行なう
– s.forEach(t -> {/**/});
178
0から10まで出力したい
for (int i = 0; i <= 10; i++) {
System.out.println(i);
}
IntStream.rangeClose(0, 10)
.forEach(i -> System.out.println(i));
179
0から10まで出力したい
for (int i = 0; i <= 10; i++) {
System.out.println(i);
}
IntStream.rangeClose(0, 10)
.forEach(System.out::println);
180
0から10までの偶数を出力したい
for (int i = 0; i <= 10; i++) {
if (i % 2 == 0) {
System.out.println(i);
}
}
181
filter[中間操作]
● filter(T -> boolean)
– フィルタリング
– 各要素を引数に適用しtrueを返したもののみ残す
– s.filter(Objects::nonNull) // nullを除外
182
filter[中間操作]
T->boolean[j.u.function.Predicate<T>#boolean test(T)]
183
0から10までの偶数を出力したい
IntStream.rangeClose(0, 10)
.filter(i -> i % 2 == 0)
.forEach(System.out::println);
184
Personのリストから名前を出力
for (Person p : persons) {
System.out.println(p.getName());
}
185
map[中間操作]
● map(T -> R)
– 写像・変換
– 各要素を引数に適用した結果のStreamを作る
– personStream.map(p -> p.getName())
186
map[中間操作]
T -> R[java.util.function.Function<T, R>#R map(T)]
R
187
Personのリストから名前を出力
persons.stream()
.map(p -> p.getName())
.forEach(n -> System.out.println(n));
188
Personのリストから名前を出力
persons.stream()
.map(Person::getName)
.forEach(System.out::println);
189
Streamを横断するmap
Stream<T> IntStream
LongStream DoubleStream
#mapToObj
#mapToInt
#mapToLong
#mapToDouble
#mapToDouble
#mapToLong
#mapToInt
190
Personのリストから名前のリスト
List<String> names = new ArrayList<>();
for (Person p : persons) {
names.add(p.getName());
}
191
collect[終端処理]
● collect(Collector<T, R>)
● collect(() -> R, (R, T) -> void, (R, R) -> void)
– 集約処理を行なう
– stream.collect(Collectors.toList())
– strings.collect(StringBuilder::new,
StringBuilder::apped, StringBuilder::apped)
192
Personのリストから名前のリスト
persons.stream()
.map(Person::getName)
.collect(Collectors.toList())
193
Putting it together
学生のリスト(students)の内
2年生で
GPAが3.5以上ある学生の
学籍番号の
リストを生成する
194
Putting it together
List<StudentID> list = new ArrayList<>();
for (Student s : students) {
if (s.getGrade() == 2 &&
s.getGPA() >= 3.5) {
list.add(s.getID());
}
}
195
Putting it together
学生のリスト(students)の内
2年生で
GPAが3.5以上ある学生の
学籍番号の
リストを生成する
196
Putting it together
students.stream()
2年生で
GPAが3.5以上ある学生の
学籍番号の
リストを生成する
197
Putting it together
students.stream()
.filter(s -> s.getGrade() == 2)
GPAが3.5以上ある学生の
学籍番号の
リストを生成する
198
Putting it together
students.stream()
.filter(s -> s.getGrade() == 2)
.filter(s -> s.getGPA() >= 3.5)
学籍番号の
リストを生成する
199
Putting it together
students.stream()
.filter(s -> s.getGrade() == 2)
.filter(s -> s.getGPA() >= 3.5)
.map(Student::getID)
リストを生成する
200
Putting it together
students.stream()
.filter(s -> s.getGrade() == 2)
.filter(s -> s.getGPA() >= 3.5)
.map(Student::getID)
.collect(Collectors.toList())
201
Putting it together
students.stream().parallel()
.filter(s -> s.getGrade() == 2)
.filter(s -> s.getGPA() >= 3.5)
.map(Student::getID)
.collect(Collectors.toList())
202
Project Lambdaまとめ
● もともとはマルチコア対応
● 結果としては汎用的な仕様に
– ラムダ式等
– コアライブラリ
● よりスマートなコードへ
203
Thank you for your listening
Enjoy JavaSE8

More Related Content

What's hot

ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2Masatoshi Tada
 
Spring Boot × Vue.jsでSPAを作る
Spring Boot × Vue.jsでSPAを作るSpring Boot × Vue.jsでSPAを作る
Spring Boot × Vue.jsでSPAを作るGo Miyasaka
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepGuo Albert
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Sam Brannen
 
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)fisuda
 
MuleアプリケーションのCI/CD
MuleアプリケーションのCI/CDMuleアプリケーションのCI/CD
MuleアプリケーションのCI/CDMuleSoft Meetup Tokyo
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentationVan Huong
 
OAuth2 and Spring Security
OAuth2 and Spring SecurityOAuth2 and Spring Security
OAuth2 and Spring SecurityOrest Ivasiv
 
Java SE 8 lambdaで変わる プログラミングスタイル
Java SE 8 lambdaで変わる プログラミングスタイルJava SE 8 lambdaで変わる プログラミングスタイル
Java SE 8 lambdaで変わる プログラミングスタイルなおき きしだ
 
MagicOnion入門
MagicOnion入門MagicOnion入門
MagicOnion入門torisoup
 
社内Java8勉強会 ラムダ式とストリームAPI
社内Java8勉強会 ラムダ式とストリームAPI社内Java8勉強会 ラムダ式とストリームAPI
社内Java8勉強会 ラムダ式とストリームAPIAkihiro Ikezoe
 
Tanzu Mission Control における Open Policy Agent (OPA) の利用
Tanzu Mission Control における Open Policy Agent (OPA) の利用Tanzu Mission Control における Open Policy Agent (OPA) の利用
Tanzu Mission Control における Open Policy Agent (OPA) の利用Motonori Shindo
 
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.3.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.3.0対応)FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.3.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.3.0対応)fisuda
 
OutSystems ユーザー会 セッション資料
OutSystems ユーザー会 セッション資料OutSystems ユーザー会 セッション資料
OutSystems ユーザー会 セッション資料Tsuyoshi Kawarasaki
 
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
API Gateway How-To: The Many Ways to Apply the Gateway PatternAPI Gateway How-To: The Many Ways to Apply the Gateway Pattern
API Gateway How-To: The Many Ways to Apply the Gateway PatternVMware Tanzu
 

What's hot (20)

Java8勉強会
Java8勉強会Java8勉強会
Java8勉強会
 
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
ステップ・バイ・ステップで学ぶラムダ式・Stream api入門 #jjug ccc #ccc h2
 
Spring Boot × Vue.jsでSPAを作る
Spring Boot × Vue.jsでSPAを作るSpring Boot × Vue.jsでSPAを作る
Spring Boot × Vue.jsでSPAを作る
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022
 
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)
 
MuleアプリケーションのCI/CD
MuleアプリケーションのCI/CDMuleアプリケーションのCI/CD
MuleアプリケーションのCI/CD
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
Open shift 4-update
Open shift 4-updateOpen shift 4-update
Open shift 4-update
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
OAuth2 and Spring Security
OAuth2 and Spring SecurityOAuth2 and Spring Security
OAuth2 and Spring Security
 
Java SE 8 lambdaで変わる プログラミングスタイル
Java SE 8 lambdaで変わる プログラミングスタイルJava SE 8 lambdaで変わる プログラミングスタイル
Java SE 8 lambdaで変わる プログラミングスタイル
 
Spring ioc
Spring iocSpring ioc
Spring ioc
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
MagicOnion入門
MagicOnion入門MagicOnion入門
MagicOnion入門
 
社内Java8勉強会 ラムダ式とストリームAPI
社内Java8勉強会 ラムダ式とストリームAPI社内Java8勉強会 ラムダ式とストリームAPI
社内Java8勉強会 ラムダ式とストリームAPI
 
Tanzu Mission Control における Open Policy Agent (OPA) の利用
Tanzu Mission Control における Open Policy Agent (OPA) の利用Tanzu Mission Control における Open Policy Agent (OPA) の利用
Tanzu Mission Control における Open Policy Agent (OPA) の利用
 
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.3.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.3.0対応)FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.3.0対応)
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.3.0対応)
 
OutSystems ユーザー会 セッション資料
OutSystems ユーザー会 セッション資料OutSystems ユーザー会 セッション資料
OutSystems ユーザー会 セッション資料
 
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
API Gateway How-To: The Many Ways to Apply the Gateway PatternAPI Gateway How-To: The Many Ways to Apply the Gateway Pattern
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
 

Viewers also liked

JavaFX 8 - GUI by Illusion
JavaFX 8 - GUI by IllusionJavaFX 8 - GUI by Illusion
JavaFX 8 - GUI by IllusionYuichi Sakuraba
 
そろそろJavaみなおしてもええんやで
そろそろJavaみなおしてもええんやでそろそろJavaみなおしてもええんやで
そろそろJavaみなおしてもええんやでなおき きしだ
 
Raspberry pi on java at Java8 Launching Event in Japan
Raspberry pi on java at Java8 Launching Event in JapanRaspberry pi on java at Java8 Launching Event in Japan
Raspberry pi on java at Java8 Launching Event in JapanMasafumi Ohta
 
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)savageautomate
 
Raspberry Pi with Java 8
Raspberry Pi with Java 8Raspberry Pi with Java 8
Raspberry Pi with Java 8javafxpert
 
徹底解説!Project Lambdaのすべて[JJUG CCC 2013 Fall H-2]
徹底解説!Project Lambdaのすべて[JJUG CCC 2013 Fall H-2]徹底解説!Project Lambdaのすべて[JJUG CCC 2013 Fall H-2]
徹底解説!Project Lambdaのすべて[JJUG CCC 2013 Fall H-2]bitter_fox
 
Java9新機能概要
Java9新機能概要Java9新機能概要
Java9新機能概要HonMarkHunt
 
だれも教えてくれないJavaの世界。 あと、ぼくが会社員になったわけ。
だれも教えてくれないJavaの世界。 あと、ぼくが会社員になったわけ。だれも教えてくれないJavaの世界。 あと、ぼくが会社員になったわけ。
だれも教えてくれないJavaの世界。 あと、ぼくが会社員になったわけ。なおき きしだ
 
10のJava9で変わるJava8の嫌なとこ!
10のJava9で変わるJava8の嫌なとこ!10のJava9で変わるJava8の嫌なとこ!
10のJava9で変わるJava8の嫌なとこ!bitter_fox
 

Viewers also liked (9)

JavaFX 8 - GUI by Illusion
JavaFX 8 - GUI by IllusionJavaFX 8 - GUI by Illusion
JavaFX 8 - GUI by Illusion
 
そろそろJavaみなおしてもええんやで
そろそろJavaみなおしてもええんやでそろそろJavaみなおしてもええんやで
そろそろJavaみなおしてもええんやで
 
Raspberry pi on java at Java8 Launching Event in Japan
Raspberry pi on java at Java8 Launching Event in JapanRaspberry pi on java at Java8 Launching Event in Japan
Raspberry pi on java at Java8 Launching Event in Japan
 
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
 
Raspberry Pi with Java 8
Raspberry Pi with Java 8Raspberry Pi with Java 8
Raspberry Pi with Java 8
 
徹底解説!Project Lambdaのすべて[JJUG CCC 2013 Fall H-2]
徹底解説!Project Lambdaのすべて[JJUG CCC 2013 Fall H-2]徹底解説!Project Lambdaのすべて[JJUG CCC 2013 Fall H-2]
徹底解説!Project Lambdaのすべて[JJUG CCC 2013 Fall H-2]
 
Java9新機能概要
Java9新機能概要Java9新機能概要
Java9新機能概要
 
だれも教えてくれないJavaの世界。 あと、ぼくが会社員になったわけ。
だれも教えてくれないJavaの世界。 あと、ぼくが会社員になったわけ。だれも教えてくれないJavaの世界。 あと、ぼくが会社員になったわけ。
だれも教えてくれないJavaの世界。 あと、ぼくが会社員になったわけ。
 
10のJava9で変わるJava8の嫌なとこ!
10のJava9で変わるJava8の嫌なとこ!10のJava9で変わるJava8の嫌なとこ!
10のJava9で変わるJava8の嫌なとこ!
 

More from bitter_fox

Introduction to JShell #JavaDayTokyo #jdt_jshell
Introduction to JShell #JavaDayTokyo #jdt_jshellIntroduction to JShell #JavaDayTokyo #jdt_jshell
Introduction to JShell #JavaDayTokyo #jdt_jshellbitter_fox
 
Introduction to JShell: the Java REPL Tool #jjug_ccc #ccc_ab4
Introduction to JShell: the Java REPL Tool #jjug_ccc #ccc_ab4Introduction to JShell: the Java REPL Tool #jjug_ccc #ccc_ab4
Introduction to JShell: the Java REPL Tool #jjug_ccc #ccc_ab4bitter_fox
 
きつねさんと学ぶ Lambda式&StreamAPIハンズオン[関ジャバ2015/7/11] #kanjava
きつねさんと学ぶ Lambda式&StreamAPIハンズオン[関ジャバ2015/7/11] #kanjavaきつねさんと学ぶ Lambda式&StreamAPIハンズオン[関ジャバ2015/7/11] #kanjava
きつねさんと学ぶ Lambda式&StreamAPIハンズオン[関ジャバ2015/7/11] #kanjavabitter_fox
 
JavaOne2014サンフランシスコ報告会in大阪
JavaOne2014サンフランシスコ報告会in大阪JavaOne2014サンフランシスコ報告会in大阪
JavaOne2014サンフランシスコ報告会in大阪bitter_fox
 
Brand new Data Processing - StreamAPI
Brand new Data Processing - StreamAPIBrand new Data Processing - StreamAPI
Brand new Data Processing - StreamAPIbitter_fox
 
徹底解説!Project Lambdaのすべて in Fukuoka #j8fk
徹底解説!Project Lambdaのすべて in Fukuoka #j8fk徹底解説!Project Lambdaのすべて in Fukuoka #j8fk
徹底解説!Project Lambdaのすべて in Fukuoka #j8fkbitter_fox
 
RCC LT 2013 Javaを日本語で書けるようにしてみた(言語処理)
RCC LT 2013 Javaを日本語で書けるようにしてみた(言語処理)RCC LT 2013 Javaを日本語で書けるようにしてみた(言語処理)
RCC LT 2013 Javaを日本語で書けるようにしてみた(言語処理)bitter_fox
 
Lt (コピー)
Lt (コピー)Lt (コピー)
Lt (コピー)bitter_fox
 

More from bitter_fox (8)

Introduction to JShell #JavaDayTokyo #jdt_jshell
Introduction to JShell #JavaDayTokyo #jdt_jshellIntroduction to JShell #JavaDayTokyo #jdt_jshell
Introduction to JShell #JavaDayTokyo #jdt_jshell
 
Introduction to JShell: the Java REPL Tool #jjug_ccc #ccc_ab4
Introduction to JShell: the Java REPL Tool #jjug_ccc #ccc_ab4Introduction to JShell: the Java REPL Tool #jjug_ccc #ccc_ab4
Introduction to JShell: the Java REPL Tool #jjug_ccc #ccc_ab4
 
きつねさんと学ぶ Lambda式&StreamAPIハンズオン[関ジャバ2015/7/11] #kanjava
きつねさんと学ぶ Lambda式&StreamAPIハンズオン[関ジャバ2015/7/11] #kanjavaきつねさんと学ぶ Lambda式&StreamAPIハンズオン[関ジャバ2015/7/11] #kanjava
きつねさんと学ぶ Lambda式&StreamAPIハンズオン[関ジャバ2015/7/11] #kanjava
 
JavaOne2014サンフランシスコ報告会in大阪
JavaOne2014サンフランシスコ報告会in大阪JavaOne2014サンフランシスコ報告会in大阪
JavaOne2014サンフランシスコ報告会in大阪
 
Brand new Data Processing - StreamAPI
Brand new Data Processing - StreamAPIBrand new Data Processing - StreamAPI
Brand new Data Processing - StreamAPI
 
徹底解説!Project Lambdaのすべて in Fukuoka #j8fk
徹底解説!Project Lambdaのすべて in Fukuoka #j8fk徹底解説!Project Lambdaのすべて in Fukuoka #j8fk
徹底解説!Project Lambdaのすべて in Fukuoka #j8fk
 
RCC LT 2013 Javaを日本語で書けるようにしてみた(言語処理)
RCC LT 2013 Javaを日本語で書けるようにしてみた(言語処理)RCC LT 2013 Javaを日本語で書けるようにしてみた(言語処理)
RCC LT 2013 Javaを日本語で書けるようにしてみた(言語処理)
 
Lt (コピー)
Lt (コピー)Lt (コピー)
Lt (コピー)
 

Recently uploaded

自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineerYuki Kikuchi
 
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)UEHARA, Tetsutaro
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)Hiroshi Tomioka
 
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...博三 太田
 
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?akihisamiyanaga1
 
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfクラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfFumieNakayama
 
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfAWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfFumieNakayama
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NTT DATA Technology & Innovation
 

Recently uploaded (8)

自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
 
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
 
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
 
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
 
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfクラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
 
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfAWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 

徹底解説!Project Lambdaのすべて リターンズ[祝Java8Launch #jjug]