Slide 1

Slide 1 text

4USFBN"1*ೖ໳ ʙ͍·͞Βฉ͚ͳ͍4USFBNͷΩϗϯ "DSPRVFTU5FDIOPMPHZגࣜձࣾ
 ೔ຊ+BWBϢʔβʔάϧʔϓ ୩ຊ৺ !DFSP@U

Slide 2

Slide 2 text

ͳͥɺ4USFBN"1*Λ
 ֶͿ΂͖ͳͷ͔ʁ

Slide 3

Slide 3 text

৽͍͔͠Βʁ ੑೳ͕͍͍͔Βʁ ؆ܿʹॻ͚Δ͔Βʁ

Slide 4

Slide 4 text

4USFBN"1*ͷΑ͏ͳ
 ෺ࣄͷଊ͑ํ͕ࠓޙ਺೥ͷ
 ίʔσΟϯάʹඞཁͱ
 ͳͬͯ͘Δ͔Β

Slide 5

Slide 5 text

ৄ͍͠࿩͸ޙͰ΍Γ·͢

Slide 6

Slide 6 text

·ͣ͸ʮ؆ܿʹॻ͚Δ͔Βʯ
 ͩͱଊ͑ͯ࢝Ί·͠ΐ͏

Slide 7

Slide 7 text

5BCMFPG$POUFOUT w 4USFBN"1*ͱ͸ʁ w -BNCEBࣜͱ͸ʁ w 4USFBN"1*ͷॻ͖ํͱɺԡ͑͞ΔϙΠϯτ w ͳͥ4USFBN"1*͕ॏཁͳͷ͔

Slide 8

Slide 8 text

4USFBN"1*ͱ͸ʁ

Slide 9

Slide 9 text

4USFBNྲྀΕ

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

ৄ͍͠࿩͸ޙͰ΍Γ·͢

Slide 12

Slide 12 text

େྔσʔλΛஞ࣍ॲཧ͢Δ
 ʮετϦʔϜॲཧʯΛ
 ؆ܿʹॻͨ͘Ίͷ"1*

Slide 13

Slide 13 text

͚ͩͲɺ
 ίϨΫγϣϯͷૢ࡞Λ
 ؆ܿʹॻ͘͜ͱ΋Ͱ͖Δ

Slide 14

Slide 14 text

List students = new ArrayList<>(); students.add(new Student("Ken", 100)); students.add(new Student("Shin", 60)); students.add(new Student("Takuya", 80)); for (Student student : students) { if (student.getScore() >= 70) { System.out.println(student); } } ͜Ε͕

Slide 15

Slide 15 text

List students = new ArrayList<>(); students.add(new Student("Ken", 100)); students.add(new Student("Shin", 60)); students.add(new Student("Takuya", 80)); 
 students.stream() .filter(s -> s.getScore() >= 70) .forEach(System.out::println); ͜͏ͳΔ

Slide 16

Slide 16 text

ίϨΫγϣϯͷ
 ߜΓࠐΈɺม׵΍ɺ
 ͦΕͧΕͷཁૉ΁ͷॲཧɺ
 ूܭͳͲ͕Ͱ͖Δ

Slide 17

Slide 17 text

ͱ͸ݴ͑

Slide 18

Slide 18 text

Map groupByDeptAndFilter(List list) { return list.stream() .collect(Collectors.groupingBy(emp -> emp.dept)) .entrySet() .stream() .collect(Collectors.toMap(entry -> entry.getKey(), entry -> entry.getValue() .stream() .filter(emp -> emp.sal > 1000) .count())); }

Slide 19

Slide 19 text

Կ͜ΕಡΊͳ͍

Slide 20

Slide 20 text

GPSจΛ࢖ͬͯ
 ॻ͖௚͢ͱ

Slide 21

Slide 21 text

Map groupByDeptClassic(List list) { Map result = new HashMap<>(); for (Emp emp : list) { if (result.containsKey(emp.dept) == false) { result.put(emp.dept, 0L); } if (emp.sal > 1000) { Long count = result.get(emp.dept); count++; result.put(emp.dept, count); } } return result; }

Slide 22

Slide 22 text

ಡΈ΍͍͢ʂ
 ✌ Т✌ ࡾ✌ Т ✌ࡾ ✌Т ✌

Slide 23

Slide 23 text

Έ͍ͨͳ͜ͱʹͳΔͷͰ
 ແཧͯ͠ෳࡶͳ΋ͷΛ
 4USFBN"1*Ͱ
 ॻ͘ඞཁ͸ͳ͍Ͱ͢

Slide 24

Slide 24 text

৽͍͠΋ͷΛ࢖͏͜ͱ͕
 ৗʹΤϥ͍Θ͚͡Όͳ͍

Slide 25

Slide 25 text

ผʹੑೳ΋มΘΜͳ͍

Slide 26

Slide 26 text

·ͣ͸جຊతͳॻ͖ํͱ
 ͦͷ֓೦Λֶͼ·͠ΐ͏

Slide 27

Slide 27 text

-BNCEBࣜͱ͸ʁ

Slide 28

Slide 28 text

˓ϥϜμࣜ
 ºϥϯόμࣜ

Slide 29

Slide 29 text

List students = new ArrayList<>(); students.add(new Student("Ken", 100)); students.add(new Student("Shin", 60)); students.add(new Student("Takuya", 80)); 
 students.stream() .filter(s -> s.getScore() >= 70) .forEach(System.out::println); ͜ͷ෦෼

Slide 30

Slide 30 text

4USFBN"1*Λ
 ؆ܿʹॻͨ͘Ίʹ
 ͔ܽͤͳ͍΋ͷ

Slide 31

Slide 31 text

-BNCEBࣜͱ͸
 ࣮૷͢΂͖ϝιου͕
 ͔ͭ͠ͳ͍ΠϯλϑΣʔεΛ
 ؆ܿʹදهͰ͖Δ΋ͷ

Slide 32

Slide 32 text

ͨͱ͑͹ KBWBVUJM$PNQBSBUPS
 
 ࣮૷͢Δ΂͖ϝιου͸
 DPNQBSF

Slide 33

Slide 33 text

void sort() { List studentList = new ArrayList<>(); studentList.add(new Student("Murata", 100)); studentList.add(new Student("Okada", 70)); studentList.add(new Student("Tanimoto", 80)); System.out.println(studentList); Collections.sort(studentList, new StudentComparator()); System.out.println(studentList); } class StudentComparator implements Comparator { @Override public int compare(Student student1, Student student2) { return Integer.compare(student1.getScore(), student2.getScore()); } } ͜ͷ෦෼

Slide 34

Slide 34 text

void sortAnonymous() { List studentList = new ArrayList<>(); studentList.add(new Student("Murata", 100)); studentList.add(new Student("Okada", 70)); studentList.add(new Student("Tanimoto", 80)); System.out.println(studentList); Collections.sort(studentList, new Comparator() { @Override public int compare(Student student1, Student student2) { return Integer.compare(student1.getScore(), student2.getScore()); } }); System.out.println(studentList); } ແ໊ΫϥεΛ࢖͏ͱ

Slide 35

Slide 35 text

void sortLambda() { List studentList = new ArrayList<>(); studentList.add(new Student("Murata", 100)); studentList.add(new Student("Okada", 70)); studentList.add(new Student("Tanimoto", 80)); System.out.println(studentList); Collections.sort(studentList, (student1, student2) -> Integer.compare(student1.getScore(), student2.getScore())); System.out.println(studentList); } -BNCEBΛ࢖͏ͱ

Slide 36

Slide 36 text

࣮૷͢΂͖ϝιου͕
 ͔ͭ͠ͳ͍ΠϯλϑΣʔεΛ
 ʮؔ਺ܕΠϯλϑΣʔεʯ
 ͬͯݺͼ·͢

Slide 37

Slide 37 text

4USFBN"1*ͷҾ਺͸
 جຊతʹ͢΂ͯ
 ؔ਺ܕΠϯλϑΣʔε

Slide 38

Slide 38 text

4USFBN"1*Λ͢΂ͯ
 ແ໊ΫϥεͰ࡞Δͱ
 ಡΈͮΒͯ͘࢓ํͳ͍ͷͰ
 ؔ਺ͬΆ͘ॻ͚Δ
 -BNCEB͕ࣜಋೖ͞Εͨ

Slide 39

Slide 39 text

List students = new ArrayList<>(); students.add(new Student("Ken", 100)); students.add(new Student("Shin", 60)); students.add(new Student("Takuya", 80)); 
 students.stream() .filter(s -> s.getScore() >= 70) .forEach(System.out::println); ΋͜͠Ε͕

Slide 40

Slide 40 text

List students = new ArrayList<>(); students.add(new Student("Ken", 100)); students.add(new Student("Shin", 60)); students.add(new Student("Takuya", 80)); students.stream() .filter(new Predicate() { @Override public boolean test(Student student) { return student.getScore() >= 70; } }) .forEach(new Consumer() { @Override public void accept(Student student) { System.out.println(student); } }); ͜͏ͳΒ

Slide 41

Slide 41 text

୭΋͓લΛѪ͞ͳ͍

Slide 42

Slide 42 text

-BNCEBࣜͷจ๏

Slide 43

Slide 43 text

-BNCEBࣜͷجຊจ๏
 
 Ҿ਺ \ॲཧ^

Slide 44

Slide 44 text

(Student student1, Student student2) -> { int score1 = student1.getScore(); int score2 = student2.getScore(); return Integer.compare(score1, score2); } (Student student) -> {
 System.out.println(student); } () -> {
 System.out.println("Hello!"); }

Slide 45

Slide 45 text

Ҿ਺ͷܕ͸লུͰ͖Δ

Slide 46

Slide 46 text

(Student student1, Student student2) -> { int score1 = student1.getScore(); int score2 = student2.getScore(); return Integer.compare(score1, score2); } (student1, student2) -> { int score1 = student1.getScore(); int score2 = student2.getScore(); return Integer.compare(score1, score2); }

Slide 47

Slide 47 text

ॲཧ͕ߦͳΒ SFUVSOͱ\^͕
 লུͰ͖Δ

Slide 48

Slide 48 text

(student1, student2) -> { int score1 = student1.getScore(); int score2 = student2.getScore(); return Integer.compare(score1, score2); } 
 
 (student1, student2) -> { return Integer.compare(student1.getScore(), student2.getScore()); } (student1, student2) -> Integer.compare(student1.getScore(), student2.getScore())

Slide 49

Slide 49 text

Ҿ਺͕ͭͳΒ
 ΋লུͰ͖Δ

Slide 50

Slide 50 text

(Student student) -> {
 System.out.println(student); } 
 
 
 student -> System.out.println(student)

Slide 51

Slide 51 text

-BNCEBͷத਎͕
 ϝιουݺͼग़ͭ͠Ͱ
 Ҿ਺΋໌֬ͳΒ
 ϝιουࢀর͕࢖͑Δ

Slide 52

Slide 52 text

ϝιουࢀরͷจ๏ Ϋϥε໊ϝιου໊

Slide 53

Slide 53 text

(Student student) -> {
 System.out.println(student); } 
 
 
 student -> System.out.println(student) System.out::println

Slide 54

Slide 54 text

(Student student) -> {
 return student.getScore(); } 
 
 
 student -> student.getScore(); Student::getScore

Slide 55

Slide 55 text

List students = new ArrayList<>(); students.add(new Student("Ken", 100)); students.add(new Student("Shin", 60)); students.add(new Student("Takuya", 80)); 
 students.stream() .filter(s -> s.getScore() >= 70) .forEach(System.out::println); ݁Ռɺ͜͏ͳΔ

Slide 56

Slide 56 text

͜͜·Ͱ͸0,ʁ

Slide 57

Slide 57 text

4USFBN"1*ͷॻ͖ํͱ
 ԡ͑͞ΔϙΠϯτ

Slide 58

Slide 58 text

࡞Δ ૢ࡞͢Δ ·ͱΊΔ

Slide 59

Slide 59 text

Α͘࢖͏ύλʔϯ
 TUSFBN Ͱ࡞Γ NBQ ͰՃ޻͠
 pMUFS ͰߜΓࠐΈ
 DPMMFDU Ͱཉ͍͠ܗʹ͢Δ

Slide 60

Slide 60 text

࡞Δ

Slide 61

Slide 61 text

4USFBNΛฦ͢"1*Λ
 ݺͼग़͢͜ͱͰ
 4USFBNΛ࡞Δ

Slide 62

Slide 62 text

List lines = Arrays.asList("Murata=100", "Okada=60", "Tanimoto=80"); List students = lines.stream() .map(s -> { String[] strings = s.split("="); return new Student(strings[0], Integer.valueOf(strings[1])); }) .filter(s -> s.getScore() >= 70) .collect(Collectors.toList()); $PMMFDUJPOTUSFBN

Slide 63

Slide 63 text

String[] lines = {"Murata=100", "Okada=60", "Tanimoto=80"}; List students = Arrays.stream(lines) .map(s -> { String[] strings = s.split("="); return new Student(strings[0], Integer.valueOf(strings[1])); }) .filter(s -> s.getScore() >= 70) .collect(Collectors.toList()); "SSBZTTUSFBN

Slide 64

Slide 64 text

.BQͳΒ FOUSZ4FU TUSFBN ϑΝΠϧΛߦͣͭಡΉͳΒ 'JMFTMJOFT #VGGFSFE3FBEFSMJOFT

Slide 65

Slide 65 text

ૢ࡞͢Δ
 ʢதؒૢ࡞ʣ

Slide 66

Slide 66 text

ઈରʹ֮͑ͯཉ͍͠ NBQͱpMUFS

Slide 67

Slide 67 text

ม׵΍ߜΓࠐΈͳͲͷ
 ૢ࡞Λߦ͏ͷ͕தؒૢ࡞

Slide 68

Slide 68 text

NBQ
 ཁૉΛผͷཁૉʹม׵͢Δ pMUFS ৚݅Λࢦఆͯ͠ߜΓࠐΉ

Slide 69

Slide 69 text

List lines = Arrays.asList("Murata=100", "Okada=60", "Tanimoto=80"); List students = lines.stream() .map(s -> { String[] strings = s.split("="); return new Student(strings[0], Integer.valueOf(strings[1])); }) .filter(s -> s.getScore() >= 70) .collect(Collectors.toList()); } NBQͱpMUFS

Slide 70

Slide 70 text

List lines = Arrays.asList("Murata=100", "Okada=60", "Tanimoto=80"); List students = lines.stream() .map(s -> { String[] strings = s.split("="); return new Student(strings[0], Integer.valueOf(strings[1])); })
 // この時点でStudentのstreamになる .filter(s -> s.getScore() >= 70) // この時点でMurataとTanimotoが残ったstreamになる .collect(Collectors.toList()); } NBQͱpMUFS

Slide 71

Slide 71 text

MJNJUͰ݅਺ΛߜΔ EJTUJODUͰϢχʔΫʹߜΔ
 TPSUFEͰฒ΂ม͑Δ
 ͳͲͳͲ

Slide 72

Slide 72 text

Α͋͘Δޡղࠞཚ

Slide 73

Slide 73 text

NBQͳͲͷม׵ॲཧͰ͸
 ཁૉͷ਺͸มΘΒͳ͍

Slide 74

Slide 74 text

ཁૉΛ͍͔ͭ͘·ͱΊͯ
 ॲཧ͢Δ
 Έ͍ͨͳ͜ͱ͸Ͱ͖ͳ͍
 ʢྫɿෳ਺ߦͷϩάϑΝΠϧॲཧʣ

Slide 75

Slide 75 text

͋͘·Ͱɺ݅݅ɺ
 Կ͔͢Δ͍ͬͯ͏΋ͷ

Slide 76

Slide 76 text

pMUFSͰ෼ذ͢Δ͜ͱ͸
 Ͱ͖ͳ͍

Slide 77

Slide 77 text

͜ͷ৚݅ͷ4USFBNɺ
 ͦͷ৚݅ͷ4USFBNɺ
 ͋ͷ৚݅ͷ4USFBNɺ
 ͲΕʹ΋֘౰͠ͳ͍4USFBN
 Έ͍ͨͳ͜ͱ͸Ͱ͖ͳ͍

Slide 78

Slide 78 text

͋͘·Ͱ΋
 4USFBN͸ຊ

Slide 79

Slide 79 text

qBU.BQΛ࢖͑͹ ͭͷཁૉ͔Β
 ෳ਺ͷཁૉΛ
 ࡞Δ͜ͱ͸Ͱ͖Δ

Slide 80

Slide 80 text

͔Β ͸࡞ΕΔ

Slide 81

Slide 81 text

Ͱ΋આ໌͸ׂѪ͢ΔΑʂ

Slide 82

Slide 82 text

·ͱΊΔ
 ʢऴ୺ૢ࡞ʣ

Slide 83

Slide 83 text

4USFBNΛ
 -JTUʹͨ͠Γ.BQʹͨ͠Γ ߹ܭ஋΍ฏۉ஋Λܭࢉͨ͠Γ

Slide 84

Slide 84 text

࠷ޙʹ݁Ռͱͯ͠
 औΓग़͢΋ͷ͕
 ऴ୺ૢ࡞

Slide 85

Slide 85 text

Ұ൪࢖͏ͷ͕
 DPMMFDUͱ$PMMFDUPSTͷ
 ૊Έ߹Θͤ

Slide 86

Slide 86 text

List lines = Arrays.asList("Murata=100", "Okada=60", "Tanimoto=80"); List students = lines.stream() .map(s -> { String[] strings = s.split("="); return new Student(strings[0], Integer.valueOf(strings[1])); }) .filter(s -> s.getScore() >= 70) .collect(Collectors.toList()); } DPMMFDU

Slide 87

Slide 87 text

$PMMFDUPSTUP4FU
 $PMMFDUPSTUP.BQ Ͱ4FU΍.BQʹม׵

Slide 88

Slide 88 text

String[] lines = {"Murata=100", "Okada=60", "Tanimoto=80"}; Map students = Arrays.stream(lines) .map(s -> { String[] strings = s.split("="); return new Student(strings[0], Integer.valueOf(strings[1])); }) .collect(Collectors.toMap(s -> s.getName(), s -> s)); return students; $PMMFDUPSTUP.BQ

Slide 89

Slide 89 text

$PMMFDUPSTKPJOJOHͰ
 શ෦ͭͳ͛ͨจࣈྻʹม׵

Slide 90

Slide 90 text

$PMMFDUPSTHSPVQJOH#Z Ͱ
 -JTUͷ.BQΛ࡞Δ

Slide 91

Slide 91 text

DPMMFDUҎ֎ͷऴ୺ૢ࡞

Slide 92

Slide 92 text

GPS&BDI
 ೚ҙͷॲཧΛ͢Δ
 ʢ໭Γ஋ͳ͠ʣ

Slide 93

Slide 93 text

NBY NJO
 ࠷େͷ݅ɺ࠷খͷ݅ΛऔΔ pOE'JSTU
 ࠷ॳͷ݅ΛऔΔ

Slide 94

Slide 94 text

਺஋ͷ4USFBNͳΒ
 BWFSBHFͱ͔΋औΕΔ

Slide 95

Slide 95 text

ཁ͢Δʹ
 4USFBNΛ
 ԿΒ͔ͷܗͰ
 ू໿ͯ͠औΓग़͢΋ͷ

Slide 96

Slide 96 text

ऴ୺ૢ࡞͸
 Ұճ͔͠Ͱ͖ͳ͍

Slide 97

Slide 97 text

UP-JTUͱGPS&BDIͷ
 ྆ํΛ͢Δ͜ͱ͸Ͱ͖ͳ͍

Slide 98

Slide 98 text

ͱ͍͏ลΓΛ౿·͑ͯ
 GSPNPME+BWB
 UPNPEFSO+BWB

Slide 99

Slide 99 text

List 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 (IOException e) { throw new RuntimeException("failed to parse date or read file", e); } return list; GSPN

Slide 100

Slide 100 text

try (Stream 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 (IOException e) { throw new UncheckedIOException("failed to read file", e); } UP4USFBN

Slide 101

Slide 101 text

try (Stream 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 (IOException e) { throw new UncheckedIOException("failed to read file", e); } UP4USFBN ϑΝΠϧΛಡΈࠐΜͰ
 Streamͱͯ͠ฦ͢ϝιου
 ʢߦ͝ͱʹॲཧʣ ߦͷStringΛ
 Transactionʹม׵ Listʹͯ͠ฦ͢

Slide 102

Slide 102 text

// 取引履歴の取得 List 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); // 6月分のみ表示 for (Transaction tx : list) { if (tx.date.getMonth() == Month.JUNE) { System.out.println(tx); } } GSPN

Slide 103

Slide 103 text

// 取引履歴の取得 read(fileName).stream() .forEach(System.out::println); // 残高の計算 int sum = read(fileName).stream() .mapToInt(tx -> tx.amount) .sum(); System.out.println(sum); // 6月分のみ表示 read(fileName).stream() .filter(tx -> tx.date.getMonth() == Month.JUNE) .forEach(System.out::println); UP4USFBN

Slide 104

Slide 104 text

// 取引履歴の取得 read(fileName).stream() .forEach(System.out::println); // 残高の計算 int sum = read(fileName).stream() .mapToInt(tx -> tx.amount) .sum(); System.out.println(sum); // 6月分のみ表示 read(fileName).stream() .filter(tx -> tx.date.getMonth() == Month.JUNE) .forEach(System.out::println); UP4USFBN ͢΂ͯͷཁૉʹ͍ͭͯ
 ॱ൪ʹॲཧ औҾֹΛint஋ͱͯ͠औΓग़ͯ͠
 intͷstreamʢIntStreamʣʹ͔ͯ͠Β
 ߹ܭ஋Λऔಘ 6݄ͷΈΛऔΓग़ͯ͠
 શ݅දࣔ

Slide 105

Slide 105 text

΋͏গ͠ࠐΈೖͬͨ಺༰͸
 ϥΠϒίʔσΟϯάͰ

Slide 106

Slide 106 text

ͳͥ4USFBN"1*͕
 ॏཁͳͷ͔ʁ

Slide 107

Slide 107 text

$PMMFDUJPOΛ؆ܿʹ
 ѻ͑ΔΑ͏ʹͳΔมΘΓʹ
 ݁ߏɺ֮͑Δ͜ͱ͕ଟ͍

Slide 108

Slide 108 text

େͯ͠༥௨΋ར͔ͳ͍

Slide 109

Slide 109 text

͡Ό͊ͳΜͰ4USFBNΛ
 ࢖͏ͷ͔ʁ

Slide 110

Slide 110 text

4USFBN"1*ͷ
 େ͖ͳ໨త͸
 4USFBNΛѻ͏͜ͱ

Slide 111

Slide 111 text

No content

Slide 112

Slide 112 text

$PMMFDUJPO͸
 طʹ಺༰͕ܾ·͍ͬͯΔ
 σʔλ ʢ$PME4USFBNʣ

Slide 113

Slide 113 text

ຊདྷͷ4USFBN͸
 ઈ͑ͣͯ͠
 ͔͠΋΋ͱͷਫʹ͋Βͣ

Slide 114

Slide 114 text

8FCͷϦΫΤετ΍
 ΩϡʔΠϯάॲཧͳͲ ಺༰΍্ݶ͕
 ܾ·ͬͯͳ͍΋ͷ
 ʢ)PU4USFBNʣ

Slide 115

Slide 115 text

+BWBͷ4USFBN"1*͸
 جຊతʹ$PME4USFBNΛ
 ѻ͏ͨΊͷ΋ͷ

Slide 116

Slide 116 text

ओઓ৔͸)PU4USFBN

Slide 117

Slide 117 text

)PU4USFBNʹ
 ඞཁͳ΋ͷ

Slide 118

Slide 118 text

΢Οϯυ΢ؔ਺

Slide 119

Slide 119 text

ྫɿ ਺ສͷηϯαʔ͔Β
 ૹ৴͞Εͨ৘ใΛ
 ड৴͠ͳ͕Β
 ूܭॲཧΛ͢Δ

Slide 120

Slide 120 text

ड৴ॲཧͱฒߦͯ͠ɺ
 ਺݅ͣͭ·ͱΊͯूܭ͢Δɺ
 ਺ඵͣͭूܭ͢Δɺ
 ໰୊͕͋Ε͹Ξϥʔτ

Slide 121

Slide 121 text

ͦΜͳ͜ͱ͕Ͱ͖Δ
 ΢Οϯυ΢ؔ਺͕ඞཁ

Slide 122

Slide 122 text

+BWBͰଟগ͸ೖΔ͕
 ࠓͷͱ͜Ζ͸
 3Y+BWB΍3FBDUPSΛ࢖͏

Slide 123

Slide 123 text

void monitorGauge(Flux input) { input.bufferTimeout(100, Duration.ofSeconds(10)) .subscribe(list -> { DoubleSummaryStatistics stats = list.stream() .mapToDouble(Double::doubleValue) .summaryStatistics(); if (stats.getMax() > maxThreshold) { alert(Level.WARNING); } if (stats.getAverage() > averageThreshold) { alert(Level.SEVERE); } }); } 3FBDUPSͷ"1*

Slide 124

Slide 124 text

void monitorGauge(Flux input) { input.bufferTimeout(100, Duration.ofSeconds(10)) .subscribe(list -> { DoubleSummaryStatistics stats = list.stream() .mapToDouble(Double::doubleValue) .summaryStatistics(); if (stats.getMax() > maxThreshold) { alert(Level.WARNING); } if (stats.getAverage() > averageThreshold) { alert(Level.SEVERE); } }); } 3FBDUPSͷ"1* 100݅΋͘͠͸10ඵؒͷσʔλΛ
 ·ͱΊͯॲཧ͢Δ ʢूܭͯ͠ᮢ஋Λ௒͑ͨΒΞϥʔτʣ

Slide 125

Slide 125 text

ϊϯϒϩοΩϯά"1*

Slide 126

Slide 126 text

ྫɿ
 σʔλετΞ͔Β
 ສ݅ͷϨίʔυΛ
 औಘͨ͋͠ͱ
 ͦͷৄࡉσʔλΛ݅ͣͭ
 ສճऔಘ͢Δ

Slide 127

Slide 127 text

֓ཁσʔλΛऔಘ͔ͯ͠Β
 ৄࡉσʔλΛऔಘ͢Δ

Slide 128

Slide 128 text

͜Ε·Ͱ͸ಉظॲཧͰ
 σʔλϕʔεʹΞΫηε͢Δ
 Α͏ͳγεςϜΛͣͬͱ
 ࡞͖ͬͯ·ͨ͠

Slide 129

Slide 129 text

42-Λສճ
 ൃߦ͢Δඞཁ͕͋Ε͹
 ॱ൪ʹສճൃߦͯ͠
 ੑೳ໰୊͕ى͖͍ͯ·ͨ͠

Slide 130

Slide 130 text

WebΞϓϦ DB 1ສճͷSQLͰ
 ੑೳ໰୊͕ൃੜ

Slide 131

Slide 131 text

WebΞϓϦ DB ͪΐͬͱ޻෉ͯ͠
 গ͠ॏ͍ͨΫΤϦͰΧόʔ

Slide 132

Slide 132 text

ϚΠΫϩαʔϏε ϚΠΫϩαʔϏε 1ສճͷαʔϏεݺͼग़͠

Slide 133

Slide 133 text

ϚΠΫϩαʔϏε ϚΠΫϩαʔϏε ͜ͷ1ສճͷαʔϏεݺͼग़͠Λ
 ʮͰ͖Δ͚ͩಉ࣌ʹʯ
 ࣮ߦ͍ͨ͠

Slide 134

Slide 134 text

ϊϯϒϩοΩϯάͳ
 ඇಉظ"1*ͱͯ͠
 ΍͸Γ
 3Y+BWBɺ3FBDUPSΛ࢖͏

Slide 135

Slide 135 text

Mono>> map =
 studentService.fetchStudents("1年3組") .flatMap(student -> scoreService.fetchScore(2017, student.id)
 .collectList() .map(scores -> Tuples.of(student, scores))) .collectMap(Tuple2::getT1, Tuple2::getT2); // 出力 System.out.println(map.block());
 
 
 // 呼び出すAPI Flux fetchStudents(String className); Flux fetchScore(int year, int id) 3FBDUPSͷ"1*

Slide 136

Slide 136 text

Mono>> map =
 studentService.fetchStudents("1年3組") .flatMap(student -> scoreService.fetchScore(2017, student.id)
 .collectList() .map(scores -> Tuples.of(student, scores))) .collectMap(Tuple2::getT1, Tuple2::getT2); // 出力 System.out.println(map.block());
 
 
 // 呼び出すAPI Flux fetchStudents(String className); Flux fetchScore(int year, int id) 3FBDUPSͷ"1* ʢৄࡉ͸ׂѪ͢Δ͚Ͳʣ
 APIݺͼग़͠ΛϊϯϒϩοΩϯά͔ͭ
 ඇಉظʹݺͼग़͢͜ͱͰ
 ॲཧશମͷ࣌ؒΛ୹ॖ
 ͔͠΋ར༻εϨου਺͕গͳ͍

Slide 137

Slide 137 text

͜͏͍͏΋ͷ͸ɺ͢΂ͯ
 4USFBN"1*ͷΑ͏ͳ
 ܗͰهड़͞ΕΔ͜ͱʹͳΔ

Slide 138

Slide 138 text

ॲཧͷฒྻ౓Λ͋͛ͯ
 େྔσʔλ΍
 େྔϦΫΤετΛ
 ࡹ͘Α͏ͳ࣌୅

Slide 139

Slide 139 text

ͦ͜ʹ޲͚ͨ४උͱͯ͠
 4USFBN"1*Λ
 शಘ͍ͯͩ͘͠͞

Slide 140

Slide 140 text

-FU`T4UVEZ
 4USFBN"1*

Slide 141

Slide 141 text

Ξϯέʔτޚڠྗ͓ئ͍͠·͢
 IUUQCJUMZKKVH

Slide 142

Slide 142 text

+BWBຊ֨ೖ໳Λ
 ങͬͯͩ͘͞Δํ͸
 ͥͻ࿩͔͚͍ͯͩ͘͠͞