So Java 7 was released yesterday. Here are a few things I found interesting taken from the release guide. Some very nice features that I have been waiting for for a long time - my favorites are the Stings in switch and catching multiple exceptions but that is just me. For the full story http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html or http://download.oracle.com/javase/7/docs/
Language
More comprehensive support for accessing file system.
Swing
Create Translucent and Shaped Windows
Concurrency
The fork/join framework, which is based on the
Networking
This method effectively eliminates the problem of how to support updated implementations of the classes and resources loaded from a particular codebase, and in particular from JAR files.
JDBC
Garbage-First Collector replaces the Concurrent Mark-Sweep Collector - targeted for multi-processors with large memories,.
Java HotSpot Virtual Machine Performance Enhancements
Language
- Binary Literals - 0b or 0B.
- Ok but I wont be using it so much.
- Underscores in Numeric Literals - Any number of underscore characters (
_
) can appear anywhere between digits in a numerical literal. - This may be quite confusing for my brain 52 == 5___2 weird but I suppose it helps with grouping
- Strings in switch Statements - You can use the
String
class in the expression of aswitch
statement. - FINALLY been waiting for this.
- Type Inference for Generic Instance Creation - You can replace the type arguments required to invoke the constructor of a generic class with an empty set of type parameters (
<>
) as long as the compiler can infer the type arguments from the context. - Bit hard to read but I will get used to it.
- Improved Compiler Warnings and Errors - The Java complier generates a warning at the declaration site of a varargs method or constructor with a non-reifiable varargs formal parameter. Java SE 7 introduces the compiler option
-Xlint:varargs
and the annotations@SafeVarargs
and@SuppressWarnings({"unchecked", "varargs"})
to supress these warnings. - The try-with-resources Statement - A resource is an object that must be closed after the program is finished with it. The
try
-with-resources statement ensures that each resource is closed at the end of the statement.java.lang.AutoCloseable,
java.io.Closeable
interface can be used as a resource. The classesjava.io.InputStream
,OutputStream
,Reader
,Writer
,java.sql.Connection
,Statement
, andResultSet
have been retrofitted to implement theAutoCloseable
interface and can all be used as resources in atry
-with-resources statement. - Catching Multiple Exception Types and Rethrowing Exceptions with Improved Type Checking - A single
catch
block can handle more than one type of exception. - Nice this will help a lot with repeated code bloat.
More comprehensive support for accessing file system.
Swing
Create Translucent and Shaped Windows
Concurrency
The fork/join framework, which is based on the
ForkJoinPool
class, is an implementation of the Executor
interface. It is designed to efficiently run a large number of tasks using a pool of worker threads. A work-stealing technique is used to keep all the worker threads busy, to take full advantage of multiple processors.Networking
URLClassLoader.close
This method effectively eliminates the problem of how to support updated implementations of the classes and resources loaded from a particular codebase, and in particular from JAR files.
JDBC
try
-with-resources automatically close resources: Connection
,ResultSet
,Statement
- RowSet 1.1: The introduction of the
RowSetFactory
interface and theRowSetProvider
class, which enable you to create all types of row sets supported by your JDBC driver.
Garbage-First Collector replaces the Concurrent Mark-Sweep Collector - targeted for multi-processors with large memories,.
Java HotSpot Virtual Machine Performance Enhancements
Comments
Post a Comment