SlideShare une entreprise Scribd logo
1  sur  108




Acroquest Technology Co., Ltd.

Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
2
Java 

Chapter 7 

Chapter 8 

Chapter 9 

Chapter 12 

Acroquest Technology 

- 2017 3 

2Twitter: @omochiya
-
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
3




Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
4








Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1.Introduction
2.Java 1.4 -> 5.0
3.Java 5.0 -> 7
4.Java 7 -> 8
5.Java 8 -> 9
6.Java 9 -> Future
5
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


6
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
7
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
8
CSV File
2017-09-25,100,123456,Acroquest,
2017-10-02,100,-28980, ,
2017-10-03,100,-17712, ,
2017-10-20,100,3000000,gihyo,
2017-10-25,100,200000,Acroquest,


, , , ,
etc
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
9
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
10
List read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List list = new ArrayList();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8"));
String line;
while ((line = reader.readLine()) != null) {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = df.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
list.add(tx);
}
} catch (ParseException e) {
throw new RuntimeException("failed to parse date", e);
} catch (IOException e) {
throw new RuntimeException("failed to read file: " + fileName, e);
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
// ignore
}
}
return list;
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
11
List read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List list = new ArrayList();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(

new FileInputStream(fileName), "UTF-8"));
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
2/3
12
String line;
while ((line = reader.readLine()) != null) {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = df.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
list.add(tx);

}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
3/3
13
} catch (ParseException e) {
throw new RuntimeException("failed to parse date", e);
} catch (IOException e) {
throw new RuntimeException("failed to read file: " + fileName, e);
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
// ignore
}
}
return list;
}
finally close
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction
14
class Transaction {
Date date;
String accountId;
Integer amount;
String name;
String note;
public Transaction() {
}
public Transaction(Date date, String accountId, Integer amount, String name, String note) {
this.date = date;
this.accountId = accountId;
this.amount = amount;
this.name = name;
this.note = note;
}
public String toString() {
return date + " " + accountId + " " + amount + " " + name + " " + note;
}
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction 1/2
15
class Transaction {
Date date;
String accountId;
Integer amount;
String name;
String note;
public Transaction() {
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction 2/2
16
public Transaction(Date date, String accountId, Integer amount, 

String name, String note) {
this.date = date;
this.accountId = accountId;
this.amount = amount;
this.name = name;
this.note = note;
}
public String toString() {
return date + " " + accountId + " " + amount + " " + name + " " + note;
}
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
-
17
List list = read(fileName);
int sum = 0;
for (int i = 0; i < list.size(); i++) {
Transaction tx = (Transaction) list.get(i);
sum += tx.amount;
}
System.out.println(sum);
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
- 6
18
List list = read(fileName);
for (int i = 0; i < list.size(); i++) {
Transaction tx = (Transaction) list.get(i);
Calendar cal = Calendar.getInstance();
cal.setTime(tx.date);
if (cal.get(Calendar.MONTH) == 5) {
System.out.println(tx);
}
}
0
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


19
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
20
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


21
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
22
List read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List list = new ArrayList();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(

new FileInputStream(fileName), "UTF-8"));
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
23
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<Transaction>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(

new FileInputStream(fileName), "UTF-8"));
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
24
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<Transaction>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(

new FileInputStream(fileName), "UTF-8"));
Generics 

→ 

→
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
-
25
List list = read(fileName);
int sum = 0;
for (int i = 0; i < list.size(); i++) {
Transaction tx = (Transaction) list.get(i);
sum += tx.amount;
}
System.out.println(sum);
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
-
26
List<Transaction> list = read(fileName);
int sum = 0;
for (Transaction tx : list) {
sum += tx.amount;
}
System.out.println(sum);
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
-
27
List<Transaction> list = read(fileName);
int sum = 0;
for (Transaction tx : list) {
sum += tx.amount;
}
System.out.println(sum);
CSV
for 

→
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


28
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction 2/2
29
public Transaction(Date date, String accountId, Integer amount, 

String name, String note) {
this.date = date;
this.accountId = accountId;
this.amount = amount;
this.name = name;
this.note = note;
}
public String toString() {
return date + " " + accountId + " " + amount + " " + name + " " + note;
}
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction 2/2
30
public Transaction(Date date, String accountId, Integer amount, 

String name, String note) {
this.date = date;
this.accountId = accountId;
this.amount = amount;
this.name = name;
this.note = note;
}
@Override
public String toString() {
return date + " " + accountId + " " + amount + " " + name + " " + note;
}
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction 2/2
31
public Transaction(Date date, String accountId, Integer amount, 

String name, String note) {
this.date = date;
this.accountId = accountId;
this.amount = amount;
this.name = name;
this.note = note;
}
@Override
public String toString() {
return date + " " + accountId + " " + amount + " " + name + " " + note;
}
}


→ Override
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
32
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
33
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


34
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


35
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
36
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<Transaction>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(

new FileInputStream(fileName), "UTF-8"));
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
37
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader =
Files.newBufferedReader(Paths.get(fileName),
StandardCharsets.UTF_8)) {
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
38
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader =
Files.newBufferedReader(Paths.get(fileName),
StandardCharsets.UTF_8)) {
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
39
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader =
Files.newBufferedReader(Paths.get(fileName),
StandardCharsets.UTF_8)) {
try-with-resoureces 

try ( ) close 

→ 

→ 

CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


40
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
41
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader =
Files.newBufferedReader(Paths.get(fileName),
StandardCharsets.UTF_8)) {
Files nio2
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1/3
42
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader =
Files.newBufferedReader(Paths.get(fileName),
StandardCharsets.UTF_8)) {
String Charset 

StandardCharsets 

→
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
3/3
43
} catch (ParseException e) {
throw new RuntimeException("failed to parse date", e);
} catch (IOException e) {
throw new RuntimeException("failed to read file: " + fileName, e);
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
// ignore
}
}
return list;
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
3/3
44
} catch (ParseException | IOException e) {
throw new RuntimeException("failed to parse date or read file”, e);
}
return list;
}
catch 

CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


45
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
46
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
47
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


48
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




49
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


50
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction toString
51
class Transaction {
Date date;
String accountId;
Integer amount;
String name;
String note;
public Transaction() {
}
public Transaction(Date date, String accountId, Integer amount, String name, String note)
{
this.date = date;
this.accountId = accountId;
this.amount = amount;
this.name = name;
this.note = note;
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction toString
52
class Transaction {
LocalDate date;
String accountId;
Integer amount;
String name;
String note;
public Transaction() {
}
public Transaction(LocalDate date, String accountId, Integer amount, String name, String
note) {
this.date = date;
this.accountId = accountId;
this.amount = amount;
this.name = name;
this.note = note;
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
Transaction toString
53
class Transaction {
LocalDate date;
String accountId;
Integer amount;
String name;
String note;
public Transaction() {
}
public Transaction(LocalDate date, String accountId, Integer amount, String name, String
note) {
this.date = date;
this.accountId = accountId;
this.amount = amount;
this.name = name;
this.note = note;
}
Date and Time API

→LocalDate 

LocalDateTime LocalTime 

OffsetDateTime ZonedDateTime 

CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3








54
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
55
List<Transaction> read(String fileName) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName),
StandardCharsets.UTF_8)) {
String line;
while ((line = reader.readLine()) != null) {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = df.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
list.add(tx);

}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
56
List<Transaction> read(String fileName) {
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName))) {
String line;
while ((line = reader.readLine()) != null) {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = LocalDate.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
list.add(tx);

}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
57
List<Transaction> read(String fileName) {
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName))) {
String line;
while ((line = reader.readLine()) != null) {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = LocalDate.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
list.add(tx);

}
UTF-8 Charset


ISO 8601 

CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


58
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
- 6
59
List<Transaction> list = read(fileName);
for (Transaction tx : list) {
Calendar cal = Calendar.getInstance();
cal.setTime(tx.date);
if (cal.get(Calendar.MONTH) == 5) {
System.out.println(tx);
}
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
- 6
60
List<Transaction> list = read(fileName);
for (Transaction tx : list) {
if (tx.date.getMonth() == Month.JUNE) {
System.out.println(tx);
}
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
- 6
61
List<Transaction> list = read(fileName);
for (Transaction tx : list) {
if (tx.date.getMonth() == Month.JUNE) {
System.out.println(tx);
}
}
enum 

enum 

→ 0 

CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




62
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
63
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




64
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


65
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
66
List<Transaction> list = new ArrayList<>();
try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName))) {
String line;
while ((line = reader.readLine()) != null) {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = LocalDate.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
list.add(tx);

}
} catch (ParseException | IOException e) {
throw new RuntimeException("failed to parse date or read file”, e);
}
return list;
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
67
try (Stream<String> stream = Files.lines(Paths.get(fileName))) {
return stream
.map(line -> {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = LocalDate.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
return tx;
})
.collect(Collectors.toList());
} catch (ParseException | IOException e) {
throw new UncheckedIOException("failed to read file", e);
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
68
try (Stream<String> stream = Files.lines(Paths.get(fileName))) {
return stream
.map(line -> {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = LocalDate.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
return tx;
})
.collect(Collectors.toList());
} catch (ParseException | IOException e) {
throw new UncheckedIOException("failed to read file", e);
}


Stream 

List
CSV


String Transaction
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
69
try (Stream<String> stream = Files.lines(Paths.get(fileName))) {
return stream
.map(line -> {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = LocalDate.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
return tx;
})
.collect(Collectors.toList());
} catch (ParseException | IOException e) {
throw new UncheckedIOException("failed to read file", e);
}
Lambda
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1
70
//
List<Transaction> list = read(fileName);
//
for (Transaction tx : list) {
System.out.println(tx);
}
//
int sum = 0;
for (Transaction tx : list) {
sum += tx.amount;
}
System.out.println(sum);
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1
71
//
read(fileName).stream()
.forEach(System.out::println);
//
int sum = read(fileName).stream()
.mapToInt(tx -> tx.amount)
.sum();
System.out.println(sum);
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1
72
//
read(fileName).stream()
.forEach(System.out::println);
//
int sum = read(fileName).stream()
.mapToInt(tx -> tx.amount)
.sum();
System.out.println(sum);
int
CSV


Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1
73
//
read(fileName).stream()
.forEach(System.out::println);
//
int sum = read(fileName).stream()
.mapToInt(tx -> tx.amount)
.sum();
System.out.println(sum);
Lambda
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
2
74
// 6 

for (Transaction tx : list) {
if (tx.date.getMonth() == Month.JUNE) {
System.out.println(tx);
}
}
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
2
75
// 6
read(fileName).stream()
.filter(tx -> tx.date.getMonth() == Month.JUNE)
.forEach(System.out::println);
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
2
76
// 6
read(fileName).stream()
.filter(tx -> tx.date.getMonth() == Month.JUNE)
.forEach(System.out::println);
6
filter
CSV
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
2
77
// 6
read(fileName).stream()
.filter(tx -> tx.date.getMonth() == Month.JUNE)
.forEach(System.out::println);
Lambda
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




78
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




79
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




80
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


81
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


82
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
83
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3






84
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




85
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




86
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3








87
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




88
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3






89
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
90
try (Stream<String> stream = Files.lines(Paths.get(fileName))) {
return stream
.map(line -> {
String[] s = line.split(",");
Transaction tx = new Transaction();
tx.date = LocalDate.parse(s[0]);
tx.accountId = s[1];
tx.amount = Integer.valueOf(s[2]);
tx.name = s[3];
tx.note = s[4];
return tx;
})
.collect(Collectors.toList());
} catch (ParseException | IOException e) {
throw new UncheckedIOException("failed to read file", e);
}


String Transaction
List
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
1
91
//
read(fileName).stream()
.forEach(System.out::println);
//
int sum = read(fileName).stream()
.mapToInt(tx -> tx.amount)
.sum();
System.out.println(sum);


int
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
2
92
// 6
read(fileName).stream()
.filter(tx -> tx.date.getMonth() == Month.JUNE)
.forEach(System.out::println);
6
filter
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3






93
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3






94
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3








95
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3








96
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
97
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
98
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3




99
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3






100
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3








101
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
JShell
102
//
jshell> List<Integer> intList = List.of(1, 2, 3);
intList ==> [1, 2, 3]
jshell> List<String> strList = List.of("aaa,", "bbb", “ccc");
strList ==> [aaa,, bbb, ccc]
jshell> intList.add(4);
| java.lang.UnsupportedOperationException thrown:
| at ImmutableCollections.uoe (ImmutableCollections.java:71)
( )
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
JShell
103
//
jshell> Map<Integer, String> map = 

Map.of(1, "aaa", 2, "bbb", 3, “ccc");
map ==> {1=aaa, 2=bbb, 3=ccc}
jshell> map.put(4, "ddd");
| java.lang.UnsupportedOperationException thrown:
| at ImmutableCollections.uoe (ImmutableCollections.java:71)
( )
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
104
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
105
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3


106
//
var str = “Hello”;
final var MAXIMUM = 100L;
// NG
var array = {1, 2, 3};
var list = new ArrayList<>();
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3
107
Copyright © Acroquest Technology Co., Ltd. All rights reserved.
#ccc_g3








108

Contenu connexe

Tendances

Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능
knight1128
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - Stockholm
Jan Kronquist
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event Systems
Leonardo Borges
 

Tendances (20)

Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++
 
Pattern Matching in Java 14
Pattern Matching in Java 14Pattern Matching in Java 14
Pattern Matching in Java 14
 
JVM Mechanics
JVM MechanicsJVM Mechanics
JVM Mechanics
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in Java
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap Dumps
 
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
 
Virtual machine and javascript engine
Virtual machine and javascript engineVirtual machine and javascript engine
Virtual machine and javascript engine
 
Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능
 
The Art of JVM Profiling
The Art of JVM ProfilingThe Art of JVM Profiling
The Art of JVM Profiling
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - Stockholm
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event Systems
 
Bridge TensorFlow to run on Intel nGraph backends (v0.5)
Bridge TensorFlow to run on Intel nGraph backends (v0.5)Bridge TensorFlow to run on Intel nGraph backends (v0.5)
Bridge TensorFlow to run on Intel nGraph backends (v0.5)
 
devday2012
devday2012devday2012
devday2012
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance Puzzlers
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with Javassist
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
Everything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsEverything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap Dumps
 
JVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's TricksJVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's Tricks
 
JEEConf 2017 - The hitchhiker’s guide to Java class reloading
JEEConf 2017 - The hitchhiker’s guide to Java class reloadingJEEConf 2017 - The hitchhiker’s guide to Java class reloading
JEEConf 2017 - The hitchhiker’s guide to Java class reloading
 
Know yourengines velocity2011
Know yourengines velocity2011Know yourengines velocity2011
Know yourengines velocity2011
 

En vedette

ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立てユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
Ryosuke Uchitate
 
マルチクラウドデータ連携Javaアプリケーションの作り方
マルチクラウドデータ連携Javaアプリケーションの作り方マルチクラウドデータ連携Javaアプリケーションの作り方
マルチクラウドデータ連携Javaアプリケーションの作り方
CData Software Japan
 

En vedette (20)

Java SE 9の紹介: モジュール・システムを中心に
Java SE 9の紹介: モジュール・システムを中心にJava SE 9の紹介: モジュール・システムを中心に
Java SE 9の紹介: モジュール・システムを中心に
 
JJUG初心者のためのJava/JJUG講座
JJUG初心者のためのJava/JJUG講座JJUG初心者のためのJava/JJUG講座
JJUG初心者のためのJava/JJUG講座
 
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立てユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
 
Spring Bootの本当の理解ポイント #jjug
Spring Bootの本当の理解ポイント #jjugSpring Bootの本当の理解ポイント #jjug
Spring Bootの本当の理解ポイント #jjug
 
劇的改善 Ci4時間から5分へ〜私がやった10のこと〜
劇的改善 Ci4時間から5分へ〜私がやった10のこと〜劇的改善 Ci4時間から5分へ〜私がやった10のこと〜
劇的改善 Ci4時間から5分へ〜私がやった10のこと〜
 
JVM上で動くPython処理系実装のススメ
JVM上で動くPython処理系実装のススメJVM上で動くPython処理系実装のススメ
JVM上で動くPython処理系実装のススメ
 
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
Dockerで始める Java EE アプリケーション開発 for JJUG CCC 2017
 
JEP280: Java 9 で文字列結合の処理が変わるぞ!準備はいいか!? #jjug_ccc
JEP280: Java 9 で文字列結合の処理が変わるぞ!準備はいいか!? #jjug_cccJEP280: Java 9 で文字列結合の処理が変わるぞ!準備はいいか!? #jjug_ccc
JEP280: Java 9 で文字列結合の処理が変わるぞ!準備はいいか!? #jjug_ccc
 
Business Process Modeling in Goldman Sachs @ JJUG CCC Fall 2017
Business Process Modeling in Goldman Sachs @ JJUG CCC Fall 2017Business Process Modeling in Goldman Sachs @ JJUG CCC Fall 2017
Business Process Modeling in Goldman Sachs @ JJUG CCC Fall 2017
 
サーバサイド Kotlin
サーバサイド Kotlinサーバサイド Kotlin
サーバサイド Kotlin
 
Selenide or Geb 〜あなたはその時どちらを使う〜
Selenide or Geb 〜あなたはその時どちらを使う〜Selenide or Geb 〜あなたはその時どちらを使う〜
Selenide or Geb 〜あなたはその時どちらを使う〜
 
Another compilation method in java - AOT (Ahead of Time) compilation
Another compilation method in java - AOT (Ahead of Time) compilationAnother compilation method in java - AOT (Ahead of Time) compilation
Another compilation method in java - AOT (Ahead of Time) compilation
 
サンプルアプリケーションで学ぶApache Cassandraを使ったJavaアプリケーションの作り方
サンプルアプリケーションで学ぶApache Cassandraを使ったJavaアプリケーションの作り方サンプルアプリケーションで学ぶApache Cassandraを使ったJavaアプリケーションの作り方
サンプルアプリケーションで学ぶApache Cassandraを使ったJavaアプリケーションの作り方
 
Javaアプリケーションの モダナイゼーションアプローチ
Javaアプリケーションの モダナイゼーションアプローチJavaアプリケーションの モダナイゼーションアプローチ
Javaアプリケーションの モダナイゼーションアプローチ
 
Open Liberty: オープンソースになったWebSphere Liberty
Open Liberty: オープンソースになったWebSphere LibertyOpen Liberty: オープンソースになったWebSphere Liberty
Open Liberty: オープンソースになったWebSphere Liberty
 
将来 自分で サービスを持ちたいエンジニアの葛藤
将来 自分で サービスを持ちたいエンジニアの葛藤 将来 自分で サービスを持ちたいエンジニアの葛藤
将来 自分で サービスを持ちたいエンジニアの葛藤
 
高速なソートアルゴリズムを書こう!!
高速なソートアルゴリズムを書こう!!高速なソートアルゴリズムを書こう!!
高速なソートアルゴリズムを書こう!!
 
マルチクラウドデータ連携Javaアプリケーションの作り方
マルチクラウドデータ連携Javaアプリケーションの作り方マルチクラウドデータ連携Javaアプリケーションの作り方
マルチクラウドデータ連携Javaアプリケーションの作り方
 
Polyglot on the JVM with Graal (English)
Polyglot on the JVM with Graal (English)Polyglot on the JVM with Graal (English)
Polyglot on the JVM with Graal (English)
 
DDD x CQRS 更新系と参照系で異なるORMを併用して上手くいった話
DDD x CQRS   更新系と参照系で異なるORMを併用して上手くいった話DDD x CQRS   更新系と参照系で異なるORMを併用して上手くいった話
DDD x CQRS 更新系と参照系で異なるORMを併用して上手くいった話
 

Similaire à Java9を迎えた今こそ!Java本格(再)入門

Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Tom Diederich
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
Jevgeni Kabanov
 

Similaire à Java9を迎えた今こそ!Java本格(再)入門 (20)

Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
 
Oczyszczacz powietrza i stos sieciowy? Czas na test! Semihalf Barcamp 13/06/2018
Oczyszczacz powietrza i stos sieciowy? Czas na test! Semihalf Barcamp 13/06/2018Oczyszczacz powietrza i stos sieciowy? Czas na test! Semihalf Barcamp 13/06/2018
Oczyszczacz powietrza i stos sieciowy? Czas na test! Semihalf Barcamp 13/06/2018
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Developing Your Own Flux Packages by David McKay | Head of Developer Relation...
Developing Your Own Flux Packages by David McKay | Head of Developer Relation...Developing Your Own Flux Packages by David McKay | Head of Developer Relation...
Developing Your Own Flux Packages by David McKay | Head of Developer Relation...
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
 
Leap Ahead with Redis 6.2
Leap Ahead with Redis 6.2Leap Ahead with Redis 6.2
Leap Ahead with Redis 6.2
 
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with easeGDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
 
Logstash-Elasticsearch-Kibana
Logstash-Elasticsearch-KibanaLogstash-Elasticsearch-Kibana
Logstash-Elasticsearch-Kibana
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
 
Codable routing
Codable routingCodable routing
Codable routing
 
Avro, la puissance du binaire, la souplesse du JSON
Avro, la puissance du binaire, la souplesse du JSONAvro, la puissance du binaire, la souplesse du JSON
Avro, la puissance du binaire, la souplesse du JSON
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
LendingClub RealTime BigData Platform with Oracle GoldenGate
LendingClub RealTime BigData Platform with Oracle GoldenGateLendingClub RealTime BigData Platform with Oracle GoldenGate
LendingClub RealTime BigData Platform with Oracle GoldenGate
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
CGI.ppt
CGI.pptCGI.ppt
CGI.ppt
 
Java fx smart code econ
Java fx smart code econJava fx smart code econ
Java fx smart code econ
 
A Practical Introduction to Handling Log Data in ClickHouse, by Robert Hodges...
A Practical Introduction to Handling Log Data in ClickHouse, by Robert Hodges...A Practical Introduction to Handling Log Data in ClickHouse, by Robert Hodges...
A Practical Introduction to Handling Log Data in ClickHouse, by Robert Hodges...
 
Metrics with Ganglia
Metrics with GangliaMetrics with Ganglia
Metrics with Ganglia
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
Build resource server &amp; client for OCF Cloud (2018.8.30)
Build resource server &amp; client for OCF Cloud (2018.8.30)Build resource server &amp; client for OCF Cloud (2018.8.30)
Build resource server &amp; client for OCF Cloud (2018.8.30)
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Java9を迎えた今こそ!Java本格(再)入門

  • 2. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 2 Java 
 Chapter 7 
 Chapter 8 
 Chapter 9 
 Chapter 12 
 Acroquest Technology 
 - 2017 3 
 2Twitter: @omochiya -
  • 3. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 3 
 

  • 4. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 4 
 
 
 

  • 5. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1.Introduction 2.Java 1.4 -> 5.0 3.Java 5.0 -> 7 4.Java 7 -> 8 5.Java 8 -> 9 6.Java 9 -> Future 5
  • 6. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 6
  • 7. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 7
  • 8. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 8 CSV File 2017-09-25,100,123456,Acroquest, 2017-10-02,100,-28980, , 2017-10-03,100,-17712, , 2017-10-20,100,3000000,gihyo, 2017-10-25,100,200000,Acroquest, 
 , , , , etc
  • 9. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 9
  • 10. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 10 List read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List list = new ArrayList(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8")); String line; while ((line = reader.readLine()) != null) { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = df.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; list.add(tx); } } catch (ParseException e) { throw new RuntimeException("failed to parse date", e); } catch (IOException e) { throw new RuntimeException("failed to read file: " + fileName, e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { // ignore } } return list; } CSV
  • 11. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 11 List read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List list = new ArrayList(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(
 new FileInputStream(fileName), "UTF-8")); CSV
  • 12. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 2/3 12 String line; while ((line = reader.readLine()) != null) { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = df.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; list.add(tx);
 } CSV
  • 13. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 3/3 13 } catch (ParseException e) { throw new RuntimeException("failed to parse date", e); } catch (IOException e) { throw new RuntimeException("failed to read file: " + fileName, e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { // ignore } } return list; } finally close CSV
  • 14. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction 14 class Transaction { Date date; String accountId; Integer amount; String name; String note; public Transaction() { } public Transaction(Date date, String accountId, Integer amount, String name, String note) { this.date = date; this.accountId = accountId; this.amount = amount; this.name = name; this.note = note; } public String toString() { return date + " " + accountId + " " + amount + " " + name + " " + note; } } CSV
  • 15. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction 1/2 15 class Transaction { Date date; String accountId; Integer amount; String name; String note; public Transaction() { } CSV
  • 16. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction 2/2 16 public Transaction(Date date, String accountId, Integer amount, 
 String name, String note) { this.date = date; this.accountId = accountId; this.amount = amount; this.name = name; this.note = note; } public String toString() { return date + " " + accountId + " " + amount + " " + name + " " + note; } } CSV
  • 17. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 - 17 List list = read(fileName); int sum = 0; for (int i = 0; i < list.size(); i++) { Transaction tx = (Transaction) list.get(i); sum += tx.amount; } System.out.println(sum); CSV
  • 18. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 - 6 18 List list = read(fileName); for (int i = 0; i < list.size(); i++) { Transaction tx = (Transaction) list.get(i); Calendar cal = Calendar.getInstance(); cal.setTime(tx.date); if (cal.get(Calendar.MONTH) == 5) { System.out.println(tx); } } 0 CSV
  • 19. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 19
  • 20. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 20
  • 21. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 21
  • 22. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 22 List read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List list = new ArrayList(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(
 new FileInputStream(fileName), "UTF-8")); CSV
  • 23. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 23 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<Transaction>(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(
 new FileInputStream(fileName), "UTF-8")); CSV
  • 24. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 24 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<Transaction>(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(
 new FileInputStream(fileName), "UTF-8")); Generics 
 → 
 → CSV
  • 25. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 - 25 List list = read(fileName); int sum = 0; for (int i = 0; i < list.size(); i++) { Transaction tx = (Transaction) list.get(i); sum += tx.amount; } System.out.println(sum); CSV
  • 26. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 - 26 List<Transaction> list = read(fileName); int sum = 0; for (Transaction tx : list) { sum += tx.amount; } System.out.println(sum); CSV
  • 27. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 - 27 List<Transaction> list = read(fileName); int sum = 0; for (Transaction tx : list) { sum += tx.amount; } System.out.println(sum); CSV for 
 →
  • 28. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 28
  • 29. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction 2/2 29 public Transaction(Date date, String accountId, Integer amount, 
 String name, String note) { this.date = date; this.accountId = accountId; this.amount = amount; this.name = name; this.note = note; } public String toString() { return date + " " + accountId + " " + amount + " " + name + " " + note; } } CSV
  • 30. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction 2/2 30 public Transaction(Date date, String accountId, Integer amount, 
 String name, String note) { this.date = date; this.accountId = accountId; this.amount = amount; this.name = name; this.note = note; } @Override public String toString() { return date + " " + accountId + " " + amount + " " + name + " " + note; } } CSV
  • 31. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction 2/2 31 public Transaction(Date date, String accountId, Integer amount, 
 String name, String note) { this.date = date; this.accountId = accountId; this.amount = amount; this.name = name; this.note = note; } @Override public String toString() { return date + " " + accountId + " " + amount + " " + name + " " + note; } } 
 → Override CSV
  • 32. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 32
  • 33. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 33
  • 34. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 34
  • 35. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 35
  • 36. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 36 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<Transaction>(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(
 new FileInputStream(fileName), "UTF-8")); CSV
  • 37. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 37 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), StandardCharsets.UTF_8)) { CSV
  • 38. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 38 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), StandardCharsets.UTF_8)) { CSV
  • 39. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 39 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), StandardCharsets.UTF_8)) { try-with-resoureces 
 try ( ) close 
 → 
 → 
 CSV
  • 40. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 40
  • 41. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 41 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), StandardCharsets.UTF_8)) { Files nio2 CSV
  • 42. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1/3 42 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), StandardCharsets.UTF_8)) { String Charset 
 StandardCharsets 
 → CSV
  • 43. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 3/3 43 } catch (ParseException e) { throw new RuntimeException("failed to parse date", e); } catch (IOException e) { throw new RuntimeException("failed to read file: " + fileName, e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { // ignore } } return list; } CSV
  • 44. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 3/3 44 } catch (ParseException | IOException e) { throw new RuntimeException("failed to parse date or read file”, e); } return list; } catch 
 CSV
  • 45. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 45
  • 46. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 46
  • 47. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 47
  • 48. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 48
  • 49. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 49
  • 50. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 50
  • 51. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction toString 51 class Transaction { Date date; String accountId; Integer amount; String name; String note; public Transaction() { } public Transaction(Date date, String accountId, Integer amount, String name, String note) { this.date = date; this.accountId = accountId; this.amount = amount; this.name = name; this.note = note; } CSV
  • 52. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction toString 52 class Transaction { LocalDate date; String accountId; Integer amount; String name; String note; public Transaction() { } public Transaction(LocalDate date, String accountId, Integer amount, String name, String note) { this.date = date; this.accountId = accountId; this.amount = amount; this.name = name; this.note = note; } CSV
  • 53. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 Transaction toString 53 class Transaction { LocalDate date; String accountId; Integer amount; String name; String note; public Transaction() { } public Transaction(LocalDate date, String accountId, Integer amount, String name, String note) { this.date = date; this.accountId = accountId; this.amount = amount; this.name = name; this.note = note; } Date and Time API
 →LocalDate 
 LocalDateTime LocalTime 
 OffsetDateTime ZonedDateTime 
 CSV
  • 54. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 
 54
  • 55. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 55 List<Transaction> read(String fileName) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), StandardCharsets.UTF_8)) { String line; while ((line = reader.readLine()) != null) { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = df.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; list.add(tx);
 } CSV
  • 56. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 56 List<Transaction> read(String fileName) { // SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName))) { String line; while ((line = reader.readLine()) != null) { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = LocalDate.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; list.add(tx);
 } CSV
  • 57. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 57 List<Transaction> read(String fileName) { // SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName))) { String line; while ((line = reader.readLine()) != null) { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = LocalDate.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; list.add(tx);
 } UTF-8 Charset 
 ISO 8601 
 CSV
  • 58. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 58
  • 59. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 - 6 59 List<Transaction> list = read(fileName); for (Transaction tx : list) { Calendar cal = Calendar.getInstance(); cal.setTime(tx.date); if (cal.get(Calendar.MONTH) == 5) { System.out.println(tx); } } CSV
  • 60. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 - 6 60 List<Transaction> list = read(fileName); for (Transaction tx : list) { if (tx.date.getMonth() == Month.JUNE) { System.out.println(tx); } } CSV
  • 61. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 - 6 61 List<Transaction> list = read(fileName); for (Transaction tx : list) { if (tx.date.getMonth() == Month.JUNE) { System.out.println(tx); } } enum 
 enum 
 → 0 
 CSV
  • 62. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 62
  • 63. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 63
  • 64. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 64
  • 65. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 65
  • 66. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 66 List<Transaction> list = new ArrayList<>(); try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName))) { String line; while ((line = reader.readLine()) != null) { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = LocalDate.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; list.add(tx);
 } } catch (ParseException | IOException e) { throw new RuntimeException("failed to parse date or read file”, e); } return list; CSV
  • 67. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 67 try (Stream<String> stream = Files.lines(Paths.get(fileName))) { return stream .map(line -> { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = LocalDate.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; return tx; }) .collect(Collectors.toList()); } catch (ParseException | IOException e) { throw new UncheckedIOException("failed to read file", e); } CSV
  • 68. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 68 try (Stream<String> stream = Files.lines(Paths.get(fileName))) { return stream .map(line -> { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = LocalDate.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; return tx; }) .collect(Collectors.toList()); } catch (ParseException | IOException e) { throw new UncheckedIOException("failed to read file", e); } 
 Stream 
 List CSV 
 String Transaction
  • 69. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 69 try (Stream<String> stream = Files.lines(Paths.get(fileName))) { return stream .map(line -> { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = LocalDate.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; return tx; }) .collect(Collectors.toList()); } catch (ParseException | IOException e) { throw new UncheckedIOException("failed to read file", e); } Lambda CSV
  • 70. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1 70 // List<Transaction> list = read(fileName); // for (Transaction tx : list) { System.out.println(tx); } // int sum = 0; for (Transaction tx : list) { sum += tx.amount; } System.out.println(sum); CSV
  • 71. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1 71 // read(fileName).stream() .forEach(System.out::println); // int sum = read(fileName).stream() .mapToInt(tx -> tx.amount) .sum(); System.out.println(sum); CSV
  • 72. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1 72 // read(fileName).stream() .forEach(System.out::println); // int sum = read(fileName).stream() .mapToInt(tx -> tx.amount) .sum(); System.out.println(sum); int CSV 

  • 73. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1 73 // read(fileName).stream() .forEach(System.out::println); // int sum = read(fileName).stream() .mapToInt(tx -> tx.amount) .sum(); System.out.println(sum); Lambda CSV
  • 74. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 2 74 // 6 
 for (Transaction tx : list) { if (tx.date.getMonth() == Month.JUNE) { System.out.println(tx); } } CSV
  • 75. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 2 75 // 6 read(fileName).stream() .filter(tx -> tx.date.getMonth() == Month.JUNE) .forEach(System.out::println); CSV
  • 76. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 2 76 // 6 read(fileName).stream() .filter(tx -> tx.date.getMonth() == Month.JUNE) .forEach(System.out::println); 6 filter CSV
  • 77. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 2 77 // 6 read(fileName).stream() .filter(tx -> tx.date.getMonth() == Month.JUNE) .forEach(System.out::println); Lambda
  • 78. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 78
  • 79. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 79
  • 80. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 80
  • 81. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 81
  • 82. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 82
  • 83. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 83
  • 84. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 84
  • 85. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 85
  • 86. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 86
  • 87. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 
 87
  • 88. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 88
  • 89. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 89
  • 90. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 90 try (Stream<String> stream = Files.lines(Paths.get(fileName))) { return stream .map(line -> { String[] s = line.split(","); Transaction tx = new Transaction(); tx.date = LocalDate.parse(s[0]); tx.accountId = s[1]; tx.amount = Integer.valueOf(s[2]); tx.name = s[3]; tx.note = s[4]; return tx; }) .collect(Collectors.toList()); } catch (ParseException | IOException e) { throw new UncheckedIOException("failed to read file", e); } 
 String Transaction List
  • 91. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 1 91 // read(fileName).stream() .forEach(System.out::println); // int sum = read(fileName).stream() .mapToInt(tx -> tx.amount) .sum(); System.out.println(sum); 
 int
  • 92. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 2 92 // 6 read(fileName).stream() .filter(tx -> tx.date.getMonth() == Month.JUNE) .forEach(System.out::println); 6 filter
  • 93. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 93
  • 94. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 94
  • 95. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 
 95
  • 96. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 
 96
  • 97. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 97
  • 98. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 98
  • 99. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 99
  • 100. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 100
  • 101. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 
 101
  • 102. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 JShell 102 // jshell> List<Integer> intList = List.of(1, 2, 3); intList ==> [1, 2, 3] jshell> List<String> strList = List.of("aaa,", "bbb", “ccc"); strList ==> [aaa,, bbb, ccc] jshell> intList.add(4); | java.lang.UnsupportedOperationException thrown: | at ImmutableCollections.uoe (ImmutableCollections.java:71) ( )
  • 103. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 JShell 103 // jshell> Map<Integer, String> map = 
 Map.of(1, "aaa", 2, "bbb", 3, “ccc"); map ==> {1=aaa, 2=bbb, 3=ccc} jshell> map.put(4, "ddd"); | java.lang.UnsupportedOperationException thrown: | at ImmutableCollections.uoe (ImmutableCollections.java:71) ( )
  • 104. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 104
  • 105. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 105
  • 106. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 106 // var str = “Hello”; final var MAXIMUM = 100L; // NG var array = {1, 2, 3}; var list = new ArrayList<>();
  • 107. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 107
  • 108. Copyright © Acroquest Technology Co., Ltd. All rights reserved. #ccc_g3 
 
 
 
 108