Olá:
Saiu a relação das alterações aprovadas para Java 7:
[list]Simplified Generics: Uso da diamond notation:[/list]
[list]Collection Literals:[/list]
List<Integer> powersOf2 = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024};
Map<String, Integer> ages = {"John" : 35, "Mary" : 28, "Steve" : 42};
[list]Automatic Resource Management[/list]
static String readFirstLineFromFile2(String path) throws IOException
{
try (BufferedReader reader = new BufferedReader(new FileReader(path))
{
return reader.readLine();
}
// reader.close() é chamado automaticamente
}
[list]String em Switchs[/list]
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;
}
[list]Binary Literals[/list]
// An 8-bit 'byte' literal.
byte aByte = (byte)0b00100001;
// A 16-bit 'short' literal.
short aShort = (short)0b1010000101000101;
// Some 32-bit 'int' literals.
int anInt1 = 0b10100001010001011010000101000101;
int anInt2 = 0b101;
int anInt3 = 0B101; // The B can be upper or lower case as per the x in "0x45".
// A 64-bit 'long' literal. Note the "L" suffix, as would also be used
// for a long in decimal, hexadecimal, or octal.
long aLong =
0b01010000101000101101000010100010110100001010001011010000101000101L;
[list]Simplified Varargs Method Invocation[/list]
/*
*EXAMPLES
*
Before this change:
*/
static <T> List<T> asList(T... elements) { ... }
static List<Callable<String>> stringFactories() {
Callable<String> a, b, c;
...
// Warning: **"uses unchecked or unsafe operations"*
return asList(a, b, c);
}
//After this change:
// Warning: **"enables unsafe generic array creation"*
static <T> List<T> asList(T... elements) { ... }
static List<Callable<String>> stringFactories() {
Callable<String> a, b, c;
...
return asList(a, b, c);
}
[size=9]Este confesso que não entendi[/size]
[list][url=http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001131.html]language support for JSR 292/url[/list]
Object x = Dynamic.getMeSomething();
Fontes:
http://blogs.sun.com/darcy/entry/project_coin_final_five