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
34
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
nobeans
0
33
OSS Product feat. Gradle
nobeans
1
39
Java開発の強力な相棒として今すぐ使えるGroovy
nobeans
0
64
Other Decks in Programming
See All in Programming
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
130
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
360
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
120
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
110
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.3k
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
410
이 함수, 실패하면 어떻게 되나요? null부터 Rich Errors까지, Kotlin 에러 처리 15년
haeti2
0
130
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
2
330
typoなんかねぇよ
raspython3
0
660
バグを直したら useEffect が消えた
colorful12
3
840
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
500
Unsuck your backbone
ammeep
672
58k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.7k
RailsConf 2023
tenderlove
30
1.5k
Embracing the Ebb and Flow
colly
88
5.2k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
440
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
920
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Skip the Path - Find Your Career Trail
mkilby
1
220
Mobile First: as difficult as doing things right
swwweet
225
10k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
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ͳͷͰɺࠓޙͱ ԿଔΑΖ͓͘͠ئ͍͍ ͨ͠·͢ɻ͍ϚδͰɻ