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
870
Other Decks in Programming
See All in Programming
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
570
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.4k
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
230
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
400
Vue3の一歩踏み込んだパフォーマンスチューニング2024
hal_spidernight
3
3.1k
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
ECSのサービス間通信 4つの方法を比較する 〜Canary,Blue/Greenも添えて〜
tkikuc
11
2.3k
Realtime API 入門
riofujimon
0
110
推し活としてのrails new/oshikatsu_ha_iizo
sakahukamaki
3
1.7k
C#/.NETのこれまでのふりかえり
tomokusaba
1
160
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
480
macOS でできる リアルタイム動画像処理
biacco42
7
1.9k
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
Building Applications with DynamoDB
mza
90
6.1k
GraphQLの誤解/rethinking-graphql
sonatard
66
9.9k
Statistics for Hackers
jakevdp
796
220k
Testing 201, or: Great Expectations
jmmastey
38
7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Cost Of JavaScript in 2023
addyosmani
45
6.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
27
1.9k
How GitHub (no longer) Works
holman
311
140k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Designing for humans not robots
tammielis
249
25k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
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༵