SlideShare a Scribd company logo
A view of possible small language changes
Java 7.0 change summary
CHANGE BULLETIN BOARD
 Better Integer Literal
 Improved type inference
 Enum comparison
 String switch
 Chained invocations &
Extension methods
 Improved catch clauses
 Array notation for Map, List
 Self type(this)
 Automatic Resource
Management
 New I/O 2 (NIO2)
Libraries
 Fork Join Framework
 Miscellaneous Things
•What is better Integer Literal ?
 Before JDK1.7
Binary literals
Int mask=0b101010101010;
 Proposed in JDK1.7
With underscores for clarity
int mask =0b1010_1010_1010 ;
long big =9_234_345_087_780L;
•Improved type inference?
 Before JDK1.7
 Constructors
Map<String,
List<String>> anagrams
= new HashMap<String,
List<String>>();
 Proposed in Jdk1.7
 Constructors
Map<String, List<String>>
anagrams = new
HashMap<>();
•Improved type inference(cont)
 Before JDK1.7
 Argument Positions
public <E> Set<E> emptySet() { … }
void timeWaitsFor(Set<Man> people)
{ … }
// * Won't compile!
timeWaitsFor(Collections.emptySet());
 Proposed in Jdk1.7
 Argument Positions
public <E> Set<E> emptySet() { … }
void timeWaitsFor(Set<Man> people) {
… }
// OK
timeWaitsFor(Collections.<Man>empt
ySet());
•What is new Enum Comparison?
 Before JDK1.7
enum Size { SMALL, MEDIUM, LARGE }
if (mySize.compareTo(yourSize) >= 0)
System.out.println(“
You can wear my pants.”);
 Proposed in Jdk1.7
enum Size { SMALL, MEDIUM,
LARGE }
if (mySize > yourSize)
System.out.println(“Y
ou can wear my
pants.”);
What is new Switch Case?
 Before JDK1.7
static boolean
booleanFromString(String s)
{
if (s.equals("true"))
{
return true;
} else if (s.equals("false"))
{
return false;
} else
{ throw new
IllegalArgumentException(s);
}
}
 Proposed in Jdk1.7
static boolean
booleanFromString(String
s) {
switch(s) {
case "true":
return true;
case "false":
return false;
default:
throw new
IllegalArgumentException(
s);
}
}
Chained invocations
 Before JDK1.7 (chained)
class Builder {
void setSomething(Something x)
{ … }
void setOther(Other x) { … }
Thing result() { … }
}
Builder builder = new Builder();
builder.setSomething(something);
builder.setOther(other);
Thing thing = builder.result();
 Proposed in Jdk1.7
class Builder {
void setSomething(Something x)
{ … }
void setOther(Other x) { … }
Thing result() { … }
}
Thing thing = new Builder()
.setSomething(something)
.setOther(other)
.result();
Extension Methods
 Before JDK1.7
import java.util.Collections;
List<String> list = …;
Collections.sort(list);
 Proposed in Jdk1.7
import static java.util.Collections.sort;
List<String> list = …;
list.sort();
•Improved catch clauses : Catching multiple types
 Before JDK1.7
try
{
return klass.newInstance();
}catch (InstantiationException e)
{
throw new AssertionError(e);
}catch (IllegalAccessException e)
{
throw new AssertionError(e);
}
 Proposed in Jdk1.7
try {
return klass.newInstance();
} catch (InstantiationException |
IllegalAccessException e) {
throw new AssertionError(e);
}
•Improved catch clauses : rethrown exceptions
 Before JDK1.7
try {
// Throws several types
doable.doit();
}
catch (Throwable ex) {
logger.log(ex);
throw ex; // Error: Throwable not
declared
}
 Proposed in Jdk1.7
try {
// Throws several types
doable.doit();
}
catch (final Throwable ex) {
logger.log(ex);
throw ex;
// OK: Throws the same several types
}
•Array notation for Map, List change
 Before JDK1.7
void swap(List<String>
list, int i, int j)
{
String s1 = list.get(i);
list.set(i,list.get(j));
list.set(j, s1);
}
 Proposed in Jdk1.7
void swap(List<String>
list, int i, int j)
{
String s1 = list[i];
list[i] = list[j];
list[j] = s1;
}
•Array notation for Map, List change(cont)
 Before JDK1.7
Map<Input,Output> cache = …;
Output cachedComputation(Input in) {
Output out = cache.get(in);
if (out == null) {
out = computation(input);
cache.put(in, out);
}
return out;
}
 Proposed in Jdk1.7
Map<Input,Output> cache = …;
Output cachedComputation(Input
in) {
Output out = cache[in];
if (out == null) {
out = computation(input);
cache[in] = out;
}
return out;
}
•What is Self type(this)?
 Before JDK1.7
class Buffer {
Buffer flip() { … }
Buffer position(int newPos) { … }
Buffer limit(int newLimit) { … }
}
class ByteBuffer extends Buffer {
ByteBuffer put(byte data) { … }
}
public static void main(String args) {
ByteBuffer buf = ...;
buf.flip().position(12); // OK
buf.flip().put(12); // Error }
 Proposed in Jdk1.7
class Buffer {
this flip() { … }
this position(int newPos) { … }
this limit(int newLimit) { … }
}
class ByteBuffer extends Buffer {
this put(byte data) { … }
}
public static void main(String args) {
ByteBuffer buf = ...;
buf.flip().position(12); // OK
buf.flip().put(12); // is fine now}
•Why Automatic Resource Management?
 Before JDK1.7
InputStream in = new FileInputStream(src);
try
{
OutputStream out = new FileOutputStream(dest);
try
{
byte[] buf = new byte[8192];
int n;
while (n = in.read(buf)) >= 0) out.write(buf, 0, n);
} finally {
out.close();
}} finally {
in.close();
}
•Why Automatic Resource Management?(cont)
 Proposed JDK1.7
try (InputStream in = new FileInputStream(src),
OutputStream out = new FileOutputStream(dest))
{
byte[] buf = new byte[8192];
int n;
while (n = in.read(buf)) >= 0)
out.write(buf, 0, n);
}
New superinterface java.lang.AutoCloseable
 All AutoCloseable and by extension java.io.Closeable types useable with try-with-
resources
 anything with a void close() method is a candidate
 JDBC 4.1 retrefitted as AutoCloseable too
What is New I/O 2 (NIO2) Libraries? (JSR 203)
Original Java I/O APIs presented challenges for developers
 Not designed to be extensible
 Many methods do not throw exceptions as expected
 rename() method works inconsistently
 Developers want greater access to file metadata
Java NIO2 solves these problems
Features of NIO2 (cont)
 Path is a replacement for File
 (Biggest impact on developers)
 Better directory support
 (list() method can stream via iterator)
 Entries can be filtered using regular expressions in API
 Symbolic link support
 java.nio.file.Filesystem
 interface to a filesystem (FAT, ZFS, Zip archive, network,
etc)
 java.nio.file.attribute package Access to file metadata
Features of NIO2 (cont)
Path Class introduction
 Equivalent of java.io.File in the new API Immutable
 Have methods to access and manipulate Path
 Few ways to create a Path - From Paths and FileSystem
//Make a reference to the path
Path home = Paths.get(“/home/fred”);
//Resolve tmp from /home/fred -> /home/fred/tmp
Path tmpPath = home.resolve(“tmp”);
//Create a relative path from tmp -> ..
Path relativePath = tmpPath.relativize(home)
File file = relativePath.toFile();
Introuction Fork Join Framework
Goal is to take advantage of multiple processor
 Designed for task that can be broken down into smaller
pieces
Eg. Fibonacci number fib(10) = fib(9) + fib(8)
 Typical algorithm that uses fork join
if I can manage the task
perform the task
else
fork task into x number of smaller/similar task
join the results
Introuction Fork Join Framework (cont)
Key Classes
 ForkJoinPool
Executor service for running ForkJoinTask
 ForkJoinTask
The base class for forkjoin task
 RecursiveAction
A subclass of ForkJoinTask
A recursive resultless task
Implements compute() abstract method to perform
calculation
 RecursiveTask
Similar to RecursiveAction but returns a result
Introuction Fork Join Framework (cont)
ForkJoin Example – Fibonacci
public class Fibonacci extends RecursiveTask<Integer>
{
private final int number;
public Fibonacci(int n) { number = n; }
@Override protected Integer compute() {
switch (number) {
case 0: return (0);
case 1: return (1);
default:
Fibonacci f1 = new Fibonacci(number – 1);
Fibonacci f2 = new Fibonacci(number – 2);
f1.fork(); f2.fork();
return (f1.join() + f2.join());
}
}
}
Introuction Fork Join Framework (cont)
ForkJoin Example – Fibonacci
ForkJoinPool pool = new ForkJoinPool();
Fibonacci r = new Fibonacci(10);
pool.submit(r);
while (!r.isDone()) {
//Do some work
...
}
System.out.println("Result of fib(10) = "+ r.get());
•Miscellaneous Things
 InvokeDynamic Bytecode
 Security
 Eliptic curve cryptography
 TLS 1.2
 JAXP 1.4.4
 JAX-WS 2.2
 JAXB 2.2
 ClassLoader architecture changes
 close() for URLClassLoader
 Javadoc support for CSS
Ad

More Related Content

What's hot (19)

Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
julien.ponge
 
srgoc
srgocsrgoc
srgoc
Gaurav Singh
 
Kotlin – the future of android
Kotlin – the future of androidKotlin – the future of android
Kotlin – the future of android
DJ Rausch
 
Java nio ( new io )
Java nio ( new io )Java nio ( new io )
Java nio ( new io )
Jemin Patel
 
Kotlin @ Coupang Backend 2017
Kotlin @ Coupang Backend 2017Kotlin @ Coupang Backend 2017
Kotlin @ Coupang Backend 2017
Sunghyouk Bae
 
Application-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta LanguageApplication-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta Language
ESUG
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
Danairat Thanabodithammachari
 
Collections forceawakens
Collections forceawakensCollections forceawakens
Collections forceawakens
RichardWarburton
 
NIO and NIO2
NIO and NIO2NIO and NIO2
NIO and NIO2
Balamurugan Soundararajan
 
Adventures in TclOO
Adventures in TclOOAdventures in TclOO
Adventures in TclOO
Donal Fellows
 
Use of Apache Commons and Utilities
Use of Apache Commons and UtilitiesUse of Apache Commons and Utilities
Use of Apache Commons and Utilities
Pramod Kumar
 
Nice to meet Kotlin
Nice to meet KotlinNice to meet Kotlin
Nice to meet Kotlin
Jieyi Wu
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are Wrong
Mario Fusco
 
JAVA NIO
JAVA NIOJAVA NIO
JAVA NIO
오석 한
 
JUnit5 and TestContainers
JUnit5 and TestContainersJUnit5 and TestContainers
JUnit5 and TestContainers
Sunghyouk Bae
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code Examples
Naresh Chintalcheru
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
Carol McDonald
 
Finagle and Java Service Framework at Pinterest
Finagle and Java Service Framework at PinterestFinagle and Java Service Framework at Pinterest
Finagle and Java Service Framework at Pinterest
Pavan Chitumalla
 
ikh331-06-distributed-programming
ikh331-06-distributed-programmingikh331-06-distributed-programming
ikh331-06-distributed-programming
Anung Ariwibowo
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
julien.ponge
 
Kotlin – the future of android
Kotlin – the future of androidKotlin – the future of android
Kotlin – the future of android
DJ Rausch
 
Java nio ( new io )
Java nio ( new io )Java nio ( new io )
Java nio ( new io )
Jemin Patel
 
Kotlin @ Coupang Backend 2017
Kotlin @ Coupang Backend 2017Kotlin @ Coupang Backend 2017
Kotlin @ Coupang Backend 2017
Sunghyouk Bae
 
Application-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta LanguageApplication-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta Language
ESUG
 
Use of Apache Commons and Utilities
Use of Apache Commons and UtilitiesUse of Apache Commons and Utilities
Use of Apache Commons and Utilities
Pramod Kumar
 
Nice to meet Kotlin
Nice to meet KotlinNice to meet Kotlin
Nice to meet Kotlin
Jieyi Wu
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are Wrong
Mario Fusco
 
JUnit5 and TestContainers
JUnit5 and TestContainersJUnit5 and TestContainers
JUnit5 and TestContainers
Sunghyouk Bae
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code Examples
Naresh Chintalcheru
 
Finagle and Java Service Framework at Pinterest
Finagle and Java Service Framework at PinterestFinagle and Java Service Framework at Pinterest
Finagle and Java Service Framework at Pinterest
Pavan Chitumalla
 
ikh331-06-distributed-programming
ikh331-06-distributed-programmingikh331-06-distributed-programming
ikh331-06-distributed-programming
Anung Ariwibowo
 

Similar to JDK1.7 features (20)

New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
Deniz Oguz
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
Mattias Karlsson
 
PostgreSQL and PL/Java
PostgreSQL and PL/JavaPostgreSQL and PL/Java
PostgreSQL and PL/Java
Peter Eisentraut
 
Ejb3 Dan Hinojosa
Ejb3 Dan HinojosaEjb3 Dan Hinojosa
Ejb3 Dan Hinojosa
Dan Hinojosa
 
Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015
Svetlin Nakov
 
Apache Beam de A à Z
 Apache Beam de A à Z Apache Beam de A à Z
Apache Beam de A à Z
Paris Data Engineers !
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
Azul Systems, Inc.
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
daewon jeong
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
Mario Fusco
 
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovWorkshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Fwdays
 
Java 7 & 8 New Features
Java 7 & 8 New FeaturesJava 7 & 8 New Features
Java 7 & 8 New Features
Leandro Coutinho
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
Doug Hawkins
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
elliando dias
 
Java
JavaJava
Java
박 경민
 
Lambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive CodeLambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive Code
Ian Robertson
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай Мозговой
Sigma Software
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
Henry Schreiner
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
Julie Iskander
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel Processing
RTigger
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
Deniz Oguz
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
Mattias Karlsson
 
Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015
Svetlin Nakov
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
Azul Systems, Inc.
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
daewon jeong
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
Mario Fusco
 
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovWorkshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Fwdays
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
Doug Hawkins
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
elliando dias
 
Lambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive CodeLambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive Code
Ian Robertson
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай Мозговой
Sigma Software
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
Henry Schreiner
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
Julie Iskander
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel Processing
RTigger
 
Ad

Recently uploaded (20)

Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Ad

JDK1.7 features

  • 1. A view of possible small language changes Java 7.0 change summary
  • 2. CHANGE BULLETIN BOARD  Better Integer Literal  Improved type inference  Enum comparison  String switch  Chained invocations & Extension methods  Improved catch clauses  Array notation for Map, List  Self type(this)  Automatic Resource Management  New I/O 2 (NIO2) Libraries  Fork Join Framework  Miscellaneous Things
  • 3. •What is better Integer Literal ?  Before JDK1.7 Binary literals Int mask=0b101010101010;  Proposed in JDK1.7 With underscores for clarity int mask =0b1010_1010_1010 ; long big =9_234_345_087_780L;
  • 4. •Improved type inference?  Before JDK1.7  Constructors Map<String, List<String>> anagrams = new HashMap<String, List<String>>();  Proposed in Jdk1.7  Constructors Map<String, List<String>> anagrams = new HashMap<>();
  • 5. •Improved type inference(cont)  Before JDK1.7  Argument Positions public <E> Set<E> emptySet() { … } void timeWaitsFor(Set<Man> people) { … } // * Won't compile! timeWaitsFor(Collections.emptySet());  Proposed in Jdk1.7  Argument Positions public <E> Set<E> emptySet() { … } void timeWaitsFor(Set<Man> people) { … } // OK timeWaitsFor(Collections.<Man>empt ySet());
  • 6. •What is new Enum Comparison?  Before JDK1.7 enum Size { SMALL, MEDIUM, LARGE } if (mySize.compareTo(yourSize) >= 0) System.out.println(“ You can wear my pants.”);  Proposed in Jdk1.7 enum Size { SMALL, MEDIUM, LARGE } if (mySize > yourSize) System.out.println(“Y ou can wear my pants.”);
  • 7. What is new Switch Case?  Before JDK1.7 static boolean booleanFromString(String s) { if (s.equals("true")) { return true; } else if (s.equals("false")) { return false; } else { throw new IllegalArgumentException(s); } }  Proposed in Jdk1.7 static boolean booleanFromString(String s) { switch(s) { case "true": return true; case "false": return false; default: throw new IllegalArgumentException( s); } }
  • 8. Chained invocations  Before JDK1.7 (chained) class Builder { void setSomething(Something x) { … } void setOther(Other x) { … } Thing result() { … } } Builder builder = new Builder(); builder.setSomething(something); builder.setOther(other); Thing thing = builder.result();  Proposed in Jdk1.7 class Builder { void setSomething(Something x) { … } void setOther(Other x) { … } Thing result() { … } } Thing thing = new Builder() .setSomething(something) .setOther(other) .result();
  • 9. Extension Methods  Before JDK1.7 import java.util.Collections; List<String> list = …; Collections.sort(list);  Proposed in Jdk1.7 import static java.util.Collections.sort; List<String> list = …; list.sort();
  • 10. •Improved catch clauses : Catching multiple types  Before JDK1.7 try { return klass.newInstance(); }catch (InstantiationException e) { throw new AssertionError(e); }catch (IllegalAccessException e) { throw new AssertionError(e); }  Proposed in Jdk1.7 try { return klass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new AssertionError(e); }
  • 11. •Improved catch clauses : rethrown exceptions  Before JDK1.7 try { // Throws several types doable.doit(); } catch (Throwable ex) { logger.log(ex); throw ex; // Error: Throwable not declared }  Proposed in Jdk1.7 try { // Throws several types doable.doit(); } catch (final Throwable ex) { logger.log(ex); throw ex; // OK: Throws the same several types }
  • 12. •Array notation for Map, List change  Before JDK1.7 void swap(List<String> list, int i, int j) { String s1 = list.get(i); list.set(i,list.get(j)); list.set(j, s1); }  Proposed in Jdk1.7 void swap(List<String> list, int i, int j) { String s1 = list[i]; list[i] = list[j]; list[j] = s1; }
  • 13. •Array notation for Map, List change(cont)  Before JDK1.7 Map<Input,Output> cache = …; Output cachedComputation(Input in) { Output out = cache.get(in); if (out == null) { out = computation(input); cache.put(in, out); } return out; }  Proposed in Jdk1.7 Map<Input,Output> cache = …; Output cachedComputation(Input in) { Output out = cache[in]; if (out == null) { out = computation(input); cache[in] = out; } return out; }
  • 14. •What is Self type(this)?  Before JDK1.7 class Buffer { Buffer flip() { … } Buffer position(int newPos) { … } Buffer limit(int newLimit) { … } } class ByteBuffer extends Buffer { ByteBuffer put(byte data) { … } } public static void main(String args) { ByteBuffer buf = ...; buf.flip().position(12); // OK buf.flip().put(12); // Error }  Proposed in Jdk1.7 class Buffer { this flip() { … } this position(int newPos) { … } this limit(int newLimit) { … } } class ByteBuffer extends Buffer { this put(byte data) { … } } public static void main(String args) { ByteBuffer buf = ...; buf.flip().position(12); // OK buf.flip().put(12); // is fine now}
  • 15. •Why Automatic Resource Management?  Before JDK1.7 InputStream in = new FileInputStream(src); try { OutputStream out = new FileOutputStream(dest); try { byte[] buf = new byte[8192]; int n; while (n = in.read(buf)) >= 0) out.write(buf, 0, n); } finally { out.close(); }} finally { in.close(); }
  • 16. •Why Automatic Resource Management?(cont)  Proposed JDK1.7 try (InputStream in = new FileInputStream(src), OutputStream out = new FileOutputStream(dest)) { byte[] buf = new byte[8192]; int n; while (n = in.read(buf)) >= 0) out.write(buf, 0, n); } New superinterface java.lang.AutoCloseable  All AutoCloseable and by extension java.io.Closeable types useable with try-with- resources  anything with a void close() method is a candidate  JDBC 4.1 retrefitted as AutoCloseable too
  • 17. What is New I/O 2 (NIO2) Libraries? (JSR 203) Original Java I/O APIs presented challenges for developers  Not designed to be extensible  Many methods do not throw exceptions as expected  rename() method works inconsistently  Developers want greater access to file metadata Java NIO2 solves these problems
  • 18. Features of NIO2 (cont)  Path is a replacement for File  (Biggest impact on developers)  Better directory support  (list() method can stream via iterator)  Entries can be filtered using regular expressions in API  Symbolic link support  java.nio.file.Filesystem  interface to a filesystem (FAT, ZFS, Zip archive, network, etc)  java.nio.file.attribute package Access to file metadata
  • 19. Features of NIO2 (cont) Path Class introduction  Equivalent of java.io.File in the new API Immutable  Have methods to access and manipulate Path  Few ways to create a Path - From Paths and FileSystem //Make a reference to the path Path home = Paths.get(“/home/fred”); //Resolve tmp from /home/fred -> /home/fred/tmp Path tmpPath = home.resolve(“tmp”); //Create a relative path from tmp -> .. Path relativePath = tmpPath.relativize(home) File file = relativePath.toFile();
  • 20. Introuction Fork Join Framework Goal is to take advantage of multiple processor  Designed for task that can be broken down into smaller pieces Eg. Fibonacci number fib(10) = fib(9) + fib(8)  Typical algorithm that uses fork join if I can manage the task perform the task else fork task into x number of smaller/similar task join the results
  • 21. Introuction Fork Join Framework (cont) Key Classes  ForkJoinPool Executor service for running ForkJoinTask  ForkJoinTask The base class for forkjoin task  RecursiveAction A subclass of ForkJoinTask A recursive resultless task Implements compute() abstract method to perform calculation  RecursiveTask Similar to RecursiveAction but returns a result
  • 22. Introuction Fork Join Framework (cont) ForkJoin Example – Fibonacci public class Fibonacci extends RecursiveTask<Integer> { private final int number; public Fibonacci(int n) { number = n; } @Override protected Integer compute() { switch (number) { case 0: return (0); case 1: return (1); default: Fibonacci f1 = new Fibonacci(number – 1); Fibonacci f2 = new Fibonacci(number – 2); f1.fork(); f2.fork(); return (f1.join() + f2.join()); } } }
  • 23. Introuction Fork Join Framework (cont) ForkJoin Example – Fibonacci ForkJoinPool pool = new ForkJoinPool(); Fibonacci r = new Fibonacci(10); pool.submit(r); while (!r.isDone()) { //Do some work ... } System.out.println("Result of fib(10) = "+ r.get());
  • 24. •Miscellaneous Things  InvokeDynamic Bytecode  Security  Eliptic curve cryptography  TLS 1.2  JAXP 1.4.4  JAX-WS 2.2  JAXB 2.2  ClassLoader architecture changes  close() for URLClassLoader  Javadoc support for CSS