Java SE next 
Otávio Santana 
@otaviojava
OpenJDK 
• Java 7 
• Java 8 
• Java 9
OpenJDK 
hg clone http://hg.openjdk.java.net/jdk9/jdk9 jdk_1_9 
sh ./get_source.sh 
./configure 
make install
OpenJDK 
Java 8 
Java 9 
Compiler 
GC 
Corelibs 
Sumatra 
JavaFX
Companies 
AMD 
Apple 
Azul Systems, Inc. 
Canonical 
Google 
IBM 
Intel 
Oracle 
RedHat 
SAP Software Company 
Stratus 
Twitter
Launched the Java 8 
● Lambda 
● Metaspace 
● Stream
Java 9 
● Build: 31 
● https://jdk9.java.net/download/ 
● Java 8 faster
Java 9 
Reflections wrappers Regex Security Core 
250 
200 
150 
100 
50 
0 
Java 8 - Process 
Java 9 -Process 
Java 8 - Memory 
Java 9 -Memory
Improvements in GC 
● Remove GC combinations deprecated 
● Strings Deduplication 
● Segmented Code Cache 
● Shenandoah
Strings duplication 
75 
25 
Heap 
Another objects String 
● 25% of Heap are Strings 
● 13.5% String duplicates 
String inside Heap 
85 
15 
String Strings duplicates
Segmented 
Code Cache 
● JVM internal (non-method) code 
● Profiled-code 
● Non-profiled code
Sumatra and OpenJFX 
● Use of GPU 
● JavaFX inside OpenJDK
Jigsaw 
● Updated at: 18/08/2014 
● The source, JDK modularized
News to coders 
● Light Write and read to JSON 
● Generics to primitives 
● builders to Collections 
● Literal to Collections 
● Process API Updates 
● Smart Java Compilation 
● http 2.0 client
News 
● List<String> list = List.of(a, b, c); 
● Set<String> set = Set.of(d, e, f, g); 
● Map<String,String> map = 
Map.of(k1, V1);//not collection 
● List<Integer> list = #[ 1, 2, 3 ];
Money Api 
● Take care of money to you :) 
● Formating 
● Rounding 
● Exchange Rate
Money Api 
CurrencyUnit euro = MonetaryCurrencies.getCurrency("EUR"); 
MonetaryAmount money = Money.of(120, euro); 
NumberValue number = money.getNumber(); 
BigDecimal value = number.numberValue(BigDecimal.class);
Money Api 
CurrencyUnit dollar = 
MonetaryCurrencies.getCurrency(Locale.US); 
MonetaryAmount m = Money.of(120, dollar); 
NumberValue number = m.getNumber(); 
BigDecimal value = number.numberValue(BigDecimal.class);
Money Api 
MonetaryAmountFormat format = 
MonetaryFormats.getAmountFormat(Locale.US); 
String text = format.format(m);//12,50 USD 
format = 
MonetaryFormats.getAmountFormat(AmountFormatQueryBuild 
er.create(Locale.US).set(CurrencyStyle.SYMBOL).build()); 
String text = format.format(m);//$123,456.56
Money Api 
MonetaryAmount noMoney = Money.of(0, euro); 
MonetaryAmount m1 = Money.of(10, euro); 
MonetaryAmount m2 = Money.of(30, euro); 
MonetaryAmount m3 = Money.of(40, euro); 
List<MonetaryAmount> moneys = Arrays.asList(m1, m2, m3); 
MonetaryAmount sum = 
moneys.stream().reduce(MonetaryFunctions.sum()).orElse(noM 
oney);
Welcome Lambda 
List<MonetaryAmount> justDollar = moneys.stream() 
.filter((MonetaryFunctions.isCurrency(DOLLAR))) 
.collect(Collectors.toList()); 
List<MonetaryAmount> notEuro = 
moneys.stream().filter((MonetaryFunctions.isNotCurrenc 
y(EURO))).collect(Collectors.toList());
Welcome Lambda 
MonetaryFunctions.isCurrency(DOLLAR).and(Monetary 
Functions.isBetween(min, max))); 
MonetaryFunctions.containsCurrencies(EURO, 
DOLLAR)).or(MonetaryFunctions.isGreaterThan(money 
)));
Welcome Lambda 
List<MonetaryAmount> orderCurrencyValue = 
moneys.stream().sorted(MonetaryFunctions.sortCurrenc 
yUnit().thenComparing(MonetaryFunctions.sortNumber 
())).collect(Collectors.toList()); 
List<MonetaryAmount> orderHighValue = 
moneys.stream().sorted(MonetaryFunctions.sortCurrenc 
yUnit().thenComparing( 
MonetaryFunctions.sortCurrencyUnitDesc())) 
.collect(Collectors.toList());
Welcome Lambda 
Map<CurrencyUnit, List<MonetaryAmount>> groupBy = 
moneys.stream().collect(MonetaryFunctions.groupByCu 
rrencyUnit());
Welcome Lambda 
MonetarySummaryStatistics summary = 
getCurrencies().stream().collect(MonetaryFunctions.sum 
marizingMonetary(DOLLAR)); 
GroupMonetarySummaryStatistics groupSummary = 
getCurrencies().stream().collect(MonetaryFunctions.gro 
upBySummarizingMonetary());
Welcome Lambda 
MonetarySummaryStatistics summary = ... 
MonetaryAmount min = summary.getMin(); 
MonetaryAmount max = summary.getMax(); 
MonetaryAmount sum = summary.getSum(); 
MonetaryAmount avarage = summary.getAverage(); 
Long count = summary.getCount();
Welcome Lambda 
GroupMonetarySummaryStatistics groupSummary =... 
Map<CurrencyUnit, MonetarySummaryStatistics> map = 
groupSummary.get(); 
MonetarySummaryStatistics summaryDollar = 
map.get(DOLLAR);
Exchange Rate 
MonetaryAmount m1 = Money.of(10, euro); 
MonetaryAmount m2 = Money.of(30, dollar); 
m1.add(m2); throw MonetaryException (“Currency mismatch...
Exchange Rate 
ExchangeRateProvider provider = 
MonetaryConversions.getExchangeRateProvider("ECB"); 
MonetaryAmount d2e = 
provider.getCurrencyConversion(euro).apply(mDollar);
Exchange Rate 
ExchangeRateProvider provider = 
MonetaryConversions.getExchangeRateProvider("IMF"); 
MonetaryAmount d2e = 
provider.getCurrencyConversion(euro).apply(mDollar);
Exchange Rate 
List<MonetaryAmount> orderCurrencyValue = 
moneys.stream().sorted(MonetaryFunctions.sortExcha 
nge(provider).collect(Collectors.toList()); 
● 9 BRL 
● 8 USD 
● 7 EUR 
● Because: 
● 1 USD = 2.4203 BRL 
● 1 USD = 2.4203 BRL 
● 1 USD = 0.79 EUR 
● 7 EUR 
● 9 BRL 
● 8 USD
Exchange Rate 
MonetaryAmount sum = 
moneys.stream().reduce(MonetafyFunctions.sum(provider 
, DOLLAR)).orElse(noMoney); 
MonetaryAmount min = 
moneys.stream().reduce(MonetafyFunctions.min(provider 
)).orElse(noMoney); 
MonetaryAmount max = 
moneys.stream().reduce(MonetafyFunctions.max(provide 
r)).orElse(noMoney);
Exchange Rate 
MonetarySummaryStatistics summary = 
getCurrencies().stream().collect(MonetaryFunctions.sum 
marizingMonetary(DOLLAR, provider));
Measurement API 
● Work with Measure 
● Standardize measure unit 
● Format 
● Operations (convert, add, subtract)
Measurement API 
QuantityFactory<Mass> massFactory = 
QuantityFactoryProvider.getQuantityFactory(Mass.class); 
Quantity<Mass> tenKilogram = massFactory.create(10, 
SI.KILOGRAM);
Measurement API 
QuantityFactory<Time> timeFactory = 
QuantityFactory.getInstance(Time.class); 
Quantity<Time> m1 = timeFactory.create(40, MINUTE); 
Quantity<Time> m2 = timeFactory.create(20, MINUTE); 
Quantity<Time> h1 = m1.add(m2).to(HOUR); //1 hour
Measurement API 
QuantityFactory<Time> timeFactory = 
QuantityFactory.getInstance(Time.class); 
Quantity<Time> m1 = timeFactory.create(1, DAY); 
Quantity<Time> m2 = timeFactory.create(12, HOUR); 
Quantity<Time> result = m1.add(m2); //1.5 day
Measurement API 
Quantity<Time> minutes = Quantities.getQuantity(15, 
SI.MINUTE); 
Quantity<Time> hours = Quantities.getQuantity(18, SI.HOUR); 
Quantity<Time> day = Quantities.getQuantity(1, SI.DAY); 
Quantity<Time> seconds = Quantities.getQuantity(100, 
SI.SECOND); 
List<Quantity<Time>> times = new ArrayList<>(); 
times.addAll(Arrays.asList(minutes, hours, day, seconds));
Measurement API 
List<Quantity<Time>> sortNaturalList = times.stream() 
.sorted(QuantityFunctions.sortNatural()) 
.collect(Collectors.toList()); 
● seconds - 100 seconds 
● minutes - 15 minutes 
● hours - 18 hours 
● day - 1 day
Measurement API 
List<Quantity<Time>> sortNaturalList = times.stream() 
.sorted(QuantityFunctions.sortNaturalDesc()) 
.collect(Collectors.toList()); 
● day - 1 day 
● hours - 18 hours 
● minutes - 15 minutes 
● seconds - 100 seconds
Measurement API 
times.add(Quantities.getQuantity(24, SI.HOUR)); 
Comparator<Quantity<Time>> sortNatural = QuantityFunctions.sortNatural(); 
Comparator<Quantity<Time>> sortSymbol = QuantityFunctions.sortSymbol(); 
List<Quantity<Time>> sortNaturaAndSymbolList = times.stream() 
.sorted(sortNatural.thenComparing(sortSymbol)) .collect(Collectors.toList()); 
● seconds - 100 seconds 
● minutes - 15 minutes 
● hours - 18 hours 
● day - 1 day 
● dayInHour – 24 hours
Measurement API 
List<Quantity<Time>> greaterThanOneDay = times 
.stream() 
.filter(QuantityFunctions.isGreaterThan(oneDay)).collect(Collect 
ors.toList()); 
List<Quantity<Time>> greaterThanOneDay = times 
.stream().filter(QuantityFunctions.isBetween(oneHour, 
oneDay)).collect(Collectors.toList());
Measurement API 
Mixing Filters 
QuantityFunctions.isGreaterThan(oneDay).and(QuantityFunctio 
ns.fiterByUnit(SI.HOUR))); 
QuantityFunctions.isGreaterThan(oneDay).or(QuantityFunction 
s.fiterByExcludingUnit(SI.DAY)));
Measurement API 
QuantitySummaryStatistics<Time> summary = 
times.stream().collect(QuantityFunctions.summarizingMeasure( 
SI.HOUR)); //result in hours 
summary.getCount(); 
summary.getAverage(); 
summary.getMax(); 
summary.getMin(); 
summary.getSum();
Measurement API 
QuantitySummaryStatistics<Time> summaryDay = 
summary.to(SI.DAY); 
summary.getMin(SI.MINUTE); 
summary.getMax(SI.MINUTE); 
summary.getSum(SI.MINUTE); 
summary.getAverage(SI.MINUTE);
Measurement API 
Quantity<Time> t1 = timeFactory.create(1, DAY); 
Quantity<Mass> m1 = timeFactory.create(12, KILOGRAM); 
Quantity<Length> l1 = timeFactory.create(12, KILOGRAM); 
t1.add(m1); //error 
Quantity<Speed> s1 = l1.divide(t1).asType(Speed.class);
Measurement API 
● Acceleration 
● Length 
● Angle 
● Area 
● Mass 
● Power 
● Energy 
● Speed 
● Force 
● Temperature 
● Time 
● Information 
● Volume 
And more! 52 quantities
It isn't a Spoiler 
Sunday, September 28 
12:30 p.m.–3:00 p.m. 
Moscone North, Hall D 
Thursday, October 2 
9:00 a.m.–10:45 a.m. 
Marriott Marquis, Salon 7/8/9
Thank you 
Otávio Santana 
@otaviojava

Java Se next Generetion

  • 1.
    Java SE next Otávio Santana @otaviojava
  • 2.
    OpenJDK • Java7 • Java 8 • Java 9
  • 3.
    OpenJDK hg clonehttp://hg.openjdk.java.net/jdk9/jdk9 jdk_1_9 sh ./get_source.sh ./configure make install
  • 4.
    OpenJDK Java 8 Java 9 Compiler GC Corelibs Sumatra JavaFX
  • 6.
    Companies AMD Apple Azul Systems, Inc. Canonical Google IBM Intel Oracle RedHat SAP Software Company Stratus Twitter
  • 7.
    Launched the Java8 ● Lambda ● Metaspace ● Stream
  • 8.
    Java 9 ●Build: 31 ● https://jdk9.java.net/download/ ● Java 8 faster
  • 9.
    Java 9 Reflectionswrappers Regex Security Core 250 200 150 100 50 0 Java 8 - Process Java 9 -Process Java 8 - Memory Java 9 -Memory
  • 10.
    Improvements in GC ● Remove GC combinations deprecated ● Strings Deduplication ● Segmented Code Cache ● Shenandoah
  • 11.
    Strings duplication 75 25 Heap Another objects String ● 25% of Heap are Strings ● 13.5% String duplicates String inside Heap 85 15 String Strings duplicates
  • 12.
    Segmented Code Cache ● JVM internal (non-method) code ● Profiled-code ● Non-profiled code
  • 13.
    Sumatra and OpenJFX ● Use of GPU ● JavaFX inside OpenJDK
  • 14.
    Jigsaw ● Updatedat: 18/08/2014 ● The source, JDK modularized
  • 15.
    News to coders ● Light Write and read to JSON ● Generics to primitives ● builders to Collections ● Literal to Collections ● Process API Updates ● Smart Java Compilation ● http 2.0 client
  • 16.
    News ● List<String>list = List.of(a, b, c); ● Set<String> set = Set.of(d, e, f, g); ● Map<String,String> map = Map.of(k1, V1);//not collection ● List<Integer> list = #[ 1, 2, 3 ];
  • 17.
    Money Api ●Take care of money to you :) ● Formating ● Rounding ● Exchange Rate
  • 18.
    Money Api CurrencyUniteuro = MonetaryCurrencies.getCurrency("EUR"); MonetaryAmount money = Money.of(120, euro); NumberValue number = money.getNumber(); BigDecimal value = number.numberValue(BigDecimal.class);
  • 19.
    Money Api CurrencyUnitdollar = MonetaryCurrencies.getCurrency(Locale.US); MonetaryAmount m = Money.of(120, dollar); NumberValue number = m.getNumber(); BigDecimal value = number.numberValue(BigDecimal.class);
  • 20.
    Money Api MonetaryAmountFormatformat = MonetaryFormats.getAmountFormat(Locale.US); String text = format.format(m);//12,50 USD format = MonetaryFormats.getAmountFormat(AmountFormatQueryBuild er.create(Locale.US).set(CurrencyStyle.SYMBOL).build()); String text = format.format(m);//$123,456.56
  • 21.
    Money Api MonetaryAmountnoMoney = Money.of(0, euro); MonetaryAmount m1 = Money.of(10, euro); MonetaryAmount m2 = Money.of(30, euro); MonetaryAmount m3 = Money.of(40, euro); List<MonetaryAmount> moneys = Arrays.asList(m1, m2, m3); MonetaryAmount sum = moneys.stream().reduce(MonetaryFunctions.sum()).orElse(noM oney);
  • 22.
    Welcome Lambda List<MonetaryAmount>justDollar = moneys.stream() .filter((MonetaryFunctions.isCurrency(DOLLAR))) .collect(Collectors.toList()); List<MonetaryAmount> notEuro = moneys.stream().filter((MonetaryFunctions.isNotCurrenc y(EURO))).collect(Collectors.toList());
  • 23.
    Welcome Lambda MonetaryFunctions.isCurrency(DOLLAR).and(Monetary Functions.isBetween(min, max))); MonetaryFunctions.containsCurrencies(EURO, DOLLAR)).or(MonetaryFunctions.isGreaterThan(money )));
  • 24.
    Welcome Lambda List<MonetaryAmount>orderCurrencyValue = moneys.stream().sorted(MonetaryFunctions.sortCurrenc yUnit().thenComparing(MonetaryFunctions.sortNumber ())).collect(Collectors.toList()); List<MonetaryAmount> orderHighValue = moneys.stream().sorted(MonetaryFunctions.sortCurrenc yUnit().thenComparing( MonetaryFunctions.sortCurrencyUnitDesc())) .collect(Collectors.toList());
  • 25.
    Welcome Lambda Map<CurrencyUnit,List<MonetaryAmount>> groupBy = moneys.stream().collect(MonetaryFunctions.groupByCu rrencyUnit());
  • 26.
    Welcome Lambda MonetarySummaryStatisticssummary = getCurrencies().stream().collect(MonetaryFunctions.sum marizingMonetary(DOLLAR)); GroupMonetarySummaryStatistics groupSummary = getCurrencies().stream().collect(MonetaryFunctions.gro upBySummarizingMonetary());
  • 27.
    Welcome Lambda MonetarySummaryStatisticssummary = ... MonetaryAmount min = summary.getMin(); MonetaryAmount max = summary.getMax(); MonetaryAmount sum = summary.getSum(); MonetaryAmount avarage = summary.getAverage(); Long count = summary.getCount();
  • 28.
    Welcome Lambda GroupMonetarySummaryStatisticsgroupSummary =... Map<CurrencyUnit, MonetarySummaryStatistics> map = groupSummary.get(); MonetarySummaryStatistics summaryDollar = map.get(DOLLAR);
  • 29.
    Exchange Rate MonetaryAmountm1 = Money.of(10, euro); MonetaryAmount m2 = Money.of(30, dollar); m1.add(m2); throw MonetaryException (“Currency mismatch...
  • 30.
    Exchange Rate ExchangeRateProviderprovider = MonetaryConversions.getExchangeRateProvider("ECB"); MonetaryAmount d2e = provider.getCurrencyConversion(euro).apply(mDollar);
  • 31.
    Exchange Rate ExchangeRateProviderprovider = MonetaryConversions.getExchangeRateProvider("IMF"); MonetaryAmount d2e = provider.getCurrencyConversion(euro).apply(mDollar);
  • 32.
    Exchange Rate List<MonetaryAmount>orderCurrencyValue = moneys.stream().sorted(MonetaryFunctions.sortExcha nge(provider).collect(Collectors.toList()); ● 9 BRL ● 8 USD ● 7 EUR ● Because: ● 1 USD = 2.4203 BRL ● 1 USD = 2.4203 BRL ● 1 USD = 0.79 EUR ● 7 EUR ● 9 BRL ● 8 USD
  • 33.
    Exchange Rate MonetaryAmountsum = moneys.stream().reduce(MonetafyFunctions.sum(provider , DOLLAR)).orElse(noMoney); MonetaryAmount min = moneys.stream().reduce(MonetafyFunctions.min(provider )).orElse(noMoney); MonetaryAmount max = moneys.stream().reduce(MonetafyFunctions.max(provide r)).orElse(noMoney);
  • 34.
    Exchange Rate MonetarySummaryStatisticssummary = getCurrencies().stream().collect(MonetaryFunctions.sum marizingMonetary(DOLLAR, provider));
  • 35.
    Measurement API ●Work with Measure ● Standardize measure unit ● Format ● Operations (convert, add, subtract)
  • 36.
    Measurement API QuantityFactory<Mass>massFactory = QuantityFactoryProvider.getQuantityFactory(Mass.class); Quantity<Mass> tenKilogram = massFactory.create(10, SI.KILOGRAM);
  • 37.
    Measurement API QuantityFactory<Time>timeFactory = QuantityFactory.getInstance(Time.class); Quantity<Time> m1 = timeFactory.create(40, MINUTE); Quantity<Time> m2 = timeFactory.create(20, MINUTE); Quantity<Time> h1 = m1.add(m2).to(HOUR); //1 hour
  • 38.
    Measurement API QuantityFactory<Time>timeFactory = QuantityFactory.getInstance(Time.class); Quantity<Time> m1 = timeFactory.create(1, DAY); Quantity<Time> m2 = timeFactory.create(12, HOUR); Quantity<Time> result = m1.add(m2); //1.5 day
  • 39.
    Measurement API Quantity<Time>minutes = Quantities.getQuantity(15, SI.MINUTE); Quantity<Time> hours = Quantities.getQuantity(18, SI.HOUR); Quantity<Time> day = Quantities.getQuantity(1, SI.DAY); Quantity<Time> seconds = Quantities.getQuantity(100, SI.SECOND); List<Quantity<Time>> times = new ArrayList<>(); times.addAll(Arrays.asList(minutes, hours, day, seconds));
  • 40.
    Measurement API List<Quantity<Time>>sortNaturalList = times.stream() .sorted(QuantityFunctions.sortNatural()) .collect(Collectors.toList()); ● seconds - 100 seconds ● minutes - 15 minutes ● hours - 18 hours ● day - 1 day
  • 41.
    Measurement API List<Quantity<Time>>sortNaturalList = times.stream() .sorted(QuantityFunctions.sortNaturalDesc()) .collect(Collectors.toList()); ● day - 1 day ● hours - 18 hours ● minutes - 15 minutes ● seconds - 100 seconds
  • 42.
    Measurement API times.add(Quantities.getQuantity(24,SI.HOUR)); Comparator<Quantity<Time>> sortNatural = QuantityFunctions.sortNatural(); Comparator<Quantity<Time>> sortSymbol = QuantityFunctions.sortSymbol(); List<Quantity<Time>> sortNaturaAndSymbolList = times.stream() .sorted(sortNatural.thenComparing(sortSymbol)) .collect(Collectors.toList()); ● seconds - 100 seconds ● minutes - 15 minutes ● hours - 18 hours ● day - 1 day ● dayInHour – 24 hours
  • 43.
    Measurement API List<Quantity<Time>>greaterThanOneDay = times .stream() .filter(QuantityFunctions.isGreaterThan(oneDay)).collect(Collect ors.toList()); List<Quantity<Time>> greaterThanOneDay = times .stream().filter(QuantityFunctions.isBetween(oneHour, oneDay)).collect(Collectors.toList());
  • 44.
    Measurement API MixingFilters QuantityFunctions.isGreaterThan(oneDay).and(QuantityFunctio ns.fiterByUnit(SI.HOUR))); QuantityFunctions.isGreaterThan(oneDay).or(QuantityFunction s.fiterByExcludingUnit(SI.DAY)));
  • 45.
    Measurement API QuantitySummaryStatistics<Time>summary = times.stream().collect(QuantityFunctions.summarizingMeasure( SI.HOUR)); //result in hours summary.getCount(); summary.getAverage(); summary.getMax(); summary.getMin(); summary.getSum();
  • 46.
    Measurement API QuantitySummaryStatistics<Time>summaryDay = summary.to(SI.DAY); summary.getMin(SI.MINUTE); summary.getMax(SI.MINUTE); summary.getSum(SI.MINUTE); summary.getAverage(SI.MINUTE);
  • 47.
    Measurement API Quantity<Time>t1 = timeFactory.create(1, DAY); Quantity<Mass> m1 = timeFactory.create(12, KILOGRAM); Quantity<Length> l1 = timeFactory.create(12, KILOGRAM); t1.add(m1); //error Quantity<Speed> s1 = l1.divide(t1).asType(Speed.class);
  • 48.
    Measurement API ●Acceleration ● Length ● Angle ● Area ● Mass ● Power ● Energy ● Speed ● Force ● Temperature ● Time ● Information ● Volume And more! 52 quantities
  • 49.
    It isn't aSpoiler Sunday, September 28 12:30 p.m.–3:00 p.m. Moscone North, Hall D Thursday, October 2 9:00 a.m.–10:45 a.m. Marriott Marquis, Salon 7/8/9
  • 50.
    Thank you OtávioSantana @otaviojava