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
JavaSE7 Launch Event: Java7xGroovy
Search
Yasuharu Nakano
March 25, 2023
Programming
34
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
90
JavaOne2010 Groovy/Spring Roo
nobeans
0
62
Groovy's Builder
nobeans
0
41
How about Gradle?
nobeans
0
22
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
nobeans
0
19
The report of JavaOne2011 about groovy
nobeans
0
33
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
nobeans
0
29
OSS Product feat. Gradle
nobeans
1
39
Java開発の強力な相棒として今すぐ使えるGroovy
nobeans
0
63
Other Decks in Programming
See All in Programming
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
2
1.3k
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
140
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
150
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
350
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
210
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
320
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
8
4.2k
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
320
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.4k
ソフトウェア設計に溶けるインフラ ― AWS CDK のインフラ認識論
konokenj
2
410
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
900
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
360
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2k
Designing Powerful Visuals for Engaging Learning
tmiket
1
450
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
630
How STYLIGHT went responsive
nonsquared
100
6.2k
Chasing Engaging Ingredients in Design
codingconduct
0
240
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
950
From π to Pie charts
rasagy
0
230
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.6k
Discover your Explorer Soul
emna__ayadi
2
1.2k
Product Roadmaps are Hard
iamctodd
55
12k
The Language of Interfaces
destraynor
162
27k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
830
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ͳͷͰɺࠓޙͱ ԿଔΑΖ͓͘͠ئ͍͍ ͨ͠·͢ɻ͍ϚδͰɻ