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
As Velhas Novas do Java 7
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Carlos Alexandro Becker
June 05, 2014
Programming
0
76
As Velhas Novas do Java 7
Carlos Alexandro Becker
June 05, 2014
Tweet
Share
More Decks by Carlos Alexandro Becker
See All by Carlos Alexandro Becker
Building GoReleaser - from shell script to paid product
caarlos0
0
4k
Serving TUIs over SSH with Go
caarlos0
0
1.9k
construindo uma carreira com opensource
caarlos0
0
470
Introdução ao GoReleaser
caarlos0
0
1.2k
Intro to GoReleaser
caarlos0
0
1.2k
Intro to GoReleaser
caarlos0
0
1.6k
Gerenciando Projetos OpenSource
caarlos0
0
1.6k
GoReleaser: Lessons Learned (hacktoberfest)
caarlos0
0
1.9k
GoReleaser: Lessons Learned
caarlos0
0
2.8k
Other Decks in Programming
See All in Programming
Patterns of Patterns
denyspoltorak
0
1.4k
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
CSC307 Lecture 08
javiergs
PRO
0
670
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
2.5k
Oxlintはいいぞ
yug1224
5
1.3k
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
690
ThorVG Viewer In VS Code
nors
0
770
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
MUSUBIXとは
nahisaho
0
130
Implementation Patterns
denyspoltorak
0
280
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
170
CSC307 Lecture 02
javiergs
PRO
1
780
Featured
See All Featured
New Earth Scene 8
popppiees
1
1.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
92
Producing Creativity
orderedlist
PRO
348
40k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Marketing to machines
jonoalderson
1
4.6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
120
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
For a Future-Friendly Web
brad_frost
182
10k
Optimizing for Happiness
mojombo
379
71k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Transcript
Java 7 as velhas novas do
Java 6: Dec 2006 Java 7: Jul 2011 Java 8:
Mar 2014 História
Lambdas, Jigsaw, e parte do Project Coin foram dropados do
Java 7
Agenda • Diamond Operator • Strings em Switch’s • Automatic
Resource Management • Numeric Literals com Underscores • Exception Handling (multi-catch) • NIO 2.0 • Fork and Join • invokedynamic
Diamond Operator // java 6 Map<String, List<String>> list6 =
new TreeMap<String, List<String>>(); // java 7 Map<String, List<String>> list7 = new TreeMap<>();
String em Switch’s // java 6 AnEnum a = AnEnum.A;
switch (a) { case A: doSomethingWhenA(); break; // … }
String em Switch’s // java 7 String b = "b";
switch(b) { case "b": doSomethingWhenB(); break; // … }
Automatic Resource Management // java 6 BlahResource resource; try {
resource = new BlahResource(); resource.doSomething(); } catch (Exception e) { log.error( “Maoeee”, e ); } finally { try { resource.close(); } catch (BlahResourceException e) { log.error( “Ah haee”, e ); } }
Automatic Resource Management // java 7 try (BlahResource resource =
new BlahResource()) { resource.doSomething(); } catch (Exception e) { log.error( “Maoeee”, e ); }
Numeric Literals // java 6 int thousand = 1000; //
java 7 int thousand = 1_000;
Exception Handling // java 6 try { oneThousandCheckedExceptionsLater(); } catch
(ExceptionOne e) { log.error(“Erro: ", e); } catch (ExceptionTwo e) { log.error(“Erro: ", e); } catch (ExceptionThree e) { log.error(“Erro: ", e); }
Exception Handling // java 7 try { oneThousandCheckedExceptionsLater(); } catch
(ExceptionOne | ExceptionTwo | ExceptionThree e) { log.error(“Erro:”, e); }
NIO 2.0 • Path & Paths • Files • FileSystems
• WatchService
Fork and Join • Dividir para conquistar • ForkJoinTask &
ForkJoinPool
incokedynamic • Recurso da JVM para suportar melhor linguagens com
tipagem dinâmica • java.lang.invoke
PROTIPS™
None
GRÁTIS NA LOJA KINDLE!
Bom e velho Javadoc ☕️
Dúvidas?
Thanks https://speakerdeck.com/caarlos0/as-velhas-novas-do-java-7