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
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Click-free releases & the making of a CLI app
oheyadam
2
120
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
受け取る人から提供する人になるということ
little_rubyist
0
250
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
930
カンファレンスの「アレ」Webでなんとかしませんか? / Conference “thing” Why don't you do something about it on the Web?
dero1to
1
100
Realtime API 入門
riofujimon
0
150
Featured
See All Featured
Designing for Performance
lara
604
68k
A Tale of Four Properties
chriscoyier
156
23k
Building Applications with DynamoDB
mza
90
6.1k
Designing the Hi-DPI Web
ddemaree
280
34k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
4 Signs Your Business is Dying
shpigford
180
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Facilitating Awesome Meetings
lara
50
6.1k
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༵