Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
渋谷Java #3
Search
mystelynx
September 28, 2013
Programming
2
260
渋谷Java #3
guava totallylazy java8
について
mystelynx
September 28, 2013
Tweet
Share
More Decks by mystelynx
See All by mystelynx
Ansible Study #1
mystelynx
1
330
Apache Commonsに関するお話
mystelynx
2
880
Other Decks in Programming
See All in Programming
Better Code Design in PHP
afilina
PRO
0
130
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
受け取る人から提供する人になるということ
little_rubyist
0
230
Remix on Hono on Cloudflare Workers
yusukebe
1
290
Arm移行タイムアタック
qnighy
0
320
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
110
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
330
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Music & Morning Musume
bryan
46
6.2k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Happy Clients
brianwarren
98
6.7k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Site-Speed That Sticks
csswizardry
0
25
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Transcript
Java8ɺͪΐͬͱͦͷલʹ ौ୩Java #3 Urakawa Tomohiro / @mystelynx 139݄28༵
ࣗݾհ Urakawa Tomohiro @mystelynx ؋ୂ࢘ྩ෦Level.19 ΫοΩʔ͞Μଔۀ͠·ͨ͠ɻ גࣜձࣾALBERTɹγεςϜ։ൃ෦ ࠷ۙRedshiftͱٔΕ͍ͯ·͢ɻ 139݄28༵
Agenda JavaͰ͑ΔؔܕϥΠϒϥϦ guava-libraries totallylazy ͦΕͧΕͷ༻্ͷҙɾ༻๏ʗ༻ྔͳͲ Java8ͱซ༻͢Δͱʁ 139݄28༵
139݄28༵
guava-libraries https:/ /code.google.com/p/guava-libraries/ ࠷৽όʔδϣϯɿ15.0 (2013/09/06) υΩϡϝϯτ͕݁ߏࡉ͔͘ॻ͔Ε͍ͯΔ ศརͳCollectionUtilitiesͳͲؚΜͰ͍Δ ࠓճؔܕϓϩάϥϛϯάػೳʹ 139݄28༵
ίʔυྫ̍ ݁ߏͬͨΒ͍͠ʢओ؍ 139݄28༵
ίʔυྫ̎ ͔ͦ͜ͱͳ͘υϠײΛײ͡Δʢओ؍ 139݄28༵
ॴײ CharMatcherͳͲᙱ͍ͱ͜Ζʹख͕ಧ͘ ແବʹ࣮͠ͳ͍ͨΊʹɺԿ͕༻ҙ͞Ε ͯΔ͔େମѲ͓ͯ͜͠͏ શମతʹΫϥεʗϝιου໊ΛۃྗΘ͔Γ ͘͢͠Α͏ͱͯ͘͠Ε͍ͯΔײ͕͋Δɻ ٯʹ͔Γʹ͍͘ʁʢmapͩΖ…ͱ͔ʣ 139݄28༵
ҙ Java8ͷඪ४ϥΠϒϥϦͱΫϥε໊͕ඃΔ java.util.function.Function vs com.google.common.base.Function java.util.function.Predicate vs com.google.common.base.Predicate ඍົʹϝιου໊͕׳Εͳ͍ 139݄28༵
139݄28༵
totallylazy https:/ /code.google.com/p/totallylazy/ ࠷৽όʔδϣϯɿ1113 (2013/08/25) υΩϡϝϯτແ͍ʢʀ∀ʀʣ ιʔεʂˠJavaDocແ͍ʢʀ∀ʀʣɹɹɹ ςετˠཏ͞Εͯͳ͍ʢʀ∀ʀʣ 139݄28༵
ઃܭࢥతʹ ClojureͷCollectionͷ༷ʹՄೳͳݶΓԆධՁ MLܥݴޠͷ໊ؔʗϝιου໊Λ౿ऻ HaskellScalaܦݧऀೃછΈ͍͔͢ HamcrestͷMatcherΛPredicateʹ͑Δ static importଟ༻ 139݄28༵
ίʔυྫ̍ େےguavaͱมΘΒͳ͍ɻ mapͱ͔filterͱ͔static import͞Εͯ·͢ 139݄28༵
ίʔυྫ̎ υϠ ιʔεΛݟͳ͕ΒؤுΔ͔͠ͳ͍ؾ͕͢Δ sequence(foo)͕ɺJava8ͷStreamͷΠϝʔδ 139݄28༵
ॴײ ͱʹ͔͘υΩϡϝϯτ͕ແ͍ ઓಆྗͷ͕ܹ͍ࠩ͠ هड़ͱʹ͔͘؆ܿɻJava8ͷϥϜμࣜͰॻ͘ ΑΓ؆ܿɻ 139݄28༵
ҙ Java8ͷඪ४ϥΠϒϥϦͱΫϥε໊͕ඃΔ com.googlecode.totallylazy.Predicate newͰΠϯελϯεੜ͢ΔͷͰͳ ͘ɺSequences, PredicatesͳͲͳͲ͔Β static importͯ͠͏ͷ͕ఆੴ eclipseͩͱ͠ΜͲ͍Πϝʔδʢओ؍ 139݄28༵
139݄28༵
Java8 https:/ /jdk8.java.net/download.html ࠷৽όʔδϣϯɿ8 build b108 2014/03ϦϦʔε༧ఆʂ ؔܕػೳͷଞʹDateTimeͱ͔ɺσϑΥϧ τϝιουͱ͔ 139݄28༵
ίʔυྫ̍ ͜ͷॻ͖ํ͢ΔͱͲΕมΘΒͳ͍Ͱ͢Ͷ 139݄28༵
ίʔυྫ̎ ͜Ε͕Ұ൪͍ؾ͕͢Δ stream()ͯ͠ɺ࠷ޙʹList͢ ϥϜμࣜ͏ͱnew new͠ͳ͍͍ͯ͘ͷͰݟ ͍͢ 139݄28༵
͍ͭͰʹ guava/totallylazyͦΕͧΕϥϜμࣜͰ guava؆ܿʹͳͬͯGood totallylazyʹͳͬͯBad 139݄28༵
·ͱΊ Ϋϥε໊͕ඃͬͯ͘ΔͷͰɺҙ͠Α͏ totallylazy͑Δͱγϯϓϧ ˞ʮ͑Δͱʯ guavaίϨΫγϣϯϢʔςΟϦςΟͳͲ ͳ͑͘Δ 139݄28༵
͓ΘΓ 139݄28༵