Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
JavaSE7 Launch Event: Java7xGroovy
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Yasuharu Nakano
March 25, 2023
Programming
38
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaSE7 Launch Event: Java7xGroovy
Yasuharu Nakano
March 25, 2023
More Decks by Yasuharu Nakano
See All by Yasuharu Nakano
GroovyServ - Technical Part
nobeans
0
97
JavaOne2010 Groovy/Spring Roo
nobeans
0
66
Groovy's Builder
nobeans
0
43
How about Gradle?
nobeans
0
22
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
nobeans
0
22
The report of JavaOne2011 about groovy
nobeans
0
37
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
nobeans
0
37
OSS Product feat. Gradle
nobeans
1
40
Java開発の強力な相棒として今すぐ使えるGroovy
nobeans
0
66
Other Decks in Programming
See All in Programming
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
190
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
270
Workers Cache を知る
syumai
0
360
ActionController meets Protocol Buffers
sorah
0
520
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
210
AWSに止められる覚悟してますか?
morizo_1984
2
530
Featured
See All Featured
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
310
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
For a Future-Friendly Web
brad_frost
184
10k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
A Modern Web Designer's Workflow
chriscoyier
699
190k
Mind Mapping
helmedeiros
1
400
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Designing for humans not robots
tammielis
254
26k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
How to build a perfect <img>
jonoalderson
1
6.1k
Transcript
+BWBʷ (SPPWZ
8IPBN* 㾎ࢯ໊ɿத༃࣏ʢBLBOPCFBOTʣ 㾎ॴଐɿ/55ιϑτΣΞגࣜձࣾ 㾎ϒϩάɿ౾ແه IUUQEIBUFOBOFKQOPCFBOT 㾎ϓϩμΫτɿ IUUQTHJUIVCDPNOPCFBOT
$ time groovy -e 'println "Hello, world!";' Hello, world! real
0m1.177s user 0m1.321s sys 0m0.171s $ time groovyclient -e 'println "Hello, world!";' Hello, world! real 0m0.029s user 0m0.001s sys 0m0.002s
None
+BWBͷͦͷػೳ (SPPWZʹطʹ ͋Γ·͚͢ͲԿ͔ʁ
4USJOHTJO 4XJUDI
+BWB4USJOHTJO4XJUDI String s = ... switch (s) { case "quux":
processQuux(s); // fall-through case "foo": case "bar": processFooOrBar(s); break; case "baz": processBaz(s); // fall-through default: processDefault(s); break; } 㾎4USJOH͕݅ذʹ͑Δ Α͏ʹͳΓ·ͨ͠ʁ
(SPPWZ"OZUIJOHJO4XJUDI import java.util.regex.Matcher Object x = ... switch (x)
{ case "abc": // xͷ༰͕"abc"ͷͱ͖ break case ~/a(.*)c/: // x͕ਖ਼نදݱύλʔϯʹϚον͢Δͱ͖ assert Matcher.lastMatcher[0][0] == "abbc" assert Matcher.lastMatcher[0][1] == "bb" break case 1..3: // x͕1ʙ3ͷൣғʹؚ·ΕΔͱ͖ break case [1,3,5]: // x͕1,3,5ͷͲΕ͔Ͱ͋Δͱ͖ break // .... }
(SPPWZ"OZUIJOHJO4XJUDI switch (x) { // .... case String: //
x͕StringͷΠϯελϯεͰ͋Δͱ͖ break case {it % 2 == 0}: // x͕ۮͷͱ͖ break case null: // x͕nullͷͱ͖ʂʂʂ break case a: // a͕ϢʔβఆٛܕͷΠϯελϯεͰ // a.isCase(x)͕trueͷͱ͖ break }
-BNCEB
+BWB-BNCEB $MPTVSF double highestScore = students .filter(#{ s -> s.gradYear
== 2010 }) .map( #{ s -> s.score }) .max(); 㾎͍ͭʹ+BWBʹΫϩʔδϟ͕ʁ
(SPPWZ$MPTVSF 㾎ຊͷΫϩʔδϟ͕طʹ͋Γ·͢ def highestScore = students. findAll({ s -> s.gradYear
== 2010 }). collect({ s -> s.score }). max() ֤छ෦ΠςϨʔγϣϯදهؚΊͯɺศ རͳίϨΫγϣϯૢ࡞ͪΖΜඋ
USZXJUI SFTPVSDFT
+BWBҎલVHMZGJOBMMZDMPTJOH InputStream in = null; OutputStream out = null; try
{ in = new FileInputStream(“src”); out = new FileOutputStream(“dst”); byte[] buf = new byte[8192]; int n = 0; while((n = in.read(buf)) >= 0) { out.write(buf, 0, n); } } catch (IOException e) { // ྫ֎ॲཧ } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } if (out != null) { try { out.close(); } catch (IOException e) { } } }
+BWBUSZXJUISFTPVSDFT try (InputStream in = new FileInputStream(“src”); OutputStream out =
new FileOutputStream(“dst”)) { byte[] buf = new byte[8192]; int n = 0; while((n = in.read(buf)) >= 0) { out.write(buf, 0, n); } }
(SPPWZ-PBO1BUUFSO new File(“dest”).withOutputStream { out -> new File(“src”).withInputStream { ins
-> byte[] buf = new byte[8192] int n = 0 while((n = ins.read(buf)) >= 0) { out.write(buf, 0, n); } } } new File("dest") << new File("src").bytes 㾎όοϑΝϦϯά͕ෆཁͳΒʢࢀߟʣ
%JBNPOE
+BWB%JBNPOE ʙ+BWB Map<String, Map<String, List<Employee>>> map = new HashMap<String, Map<String,
List<Employee>>>(); +BWB Map<String, Map<String, List<Employee>>> map = new HashMap<>();
(SPPWZδΣωϦΫεͷܕࢦఆͳΜͯͨͩͷ০ΓͰ͢ ŝžŕ Map<String, Map<String, List<Employee>>> map = [:] map.put(1, “A”)
// ʮ͑ͬʁʯ map.put(“HOGE”, new Date()) // ʮ͑ͬʁʯ
'PSL+PJO 'SBNXPSL
+BWB'PSL+PJO'SBNFXPSL import java.util.concurrent.*; public class Fibonacci extends RecursiveTask<Integer> { final
int n; public Fibonacci(int n) { this.n = n; } public Integer compute() { if (n <= 1) return n; Fibonacci f1 = new Fibonacci(n - 1); f1.fork(); Fibonacci f2 = new Fibonacci(n - 2); return f2.compute() + f1.join(); } }
(SPPWZ(1BST import static groovyx.gpars.GParsPool.* def fibo(num) { withPool { runForkJoin(num)
{ n -> switch (n) { case 0..1: return n default: forkOffChild(n - 1) forkOffChild(n - 2) childrenResults.sum() } } } } assert fibo(10) == 55 assert fibo(20) == 6765 㾎 ଞʹˣʹରԠ 㾎 1BSBMMFM"SSBZ 㾎 .BQ3FEVDF 㾎 4DBMBͷ"DUPS 㾎 $MPKVSFͷ"HFOU
+BWBͷډΔॴ ɺطʹ (SPPWZ͕˓લ ʹ௨աͨ͠ॴͩο
ͱɺἤͬͯॻ͍ͯΈ·ͨ͠ ͕ɺ+BWB͕͋ͬͯͦ͜ͷ (SPPWZͳͷͰɺࠓޙͱ ԿଔΑΖ͓͘͠ئ͍͍ ͨ͠·͢ɻ͍ϚδͰɻ