The characteristics of JDK1.7

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

The new features of jdk1.7:  
1, Switch can use the string
Java code
String s = "test";  
switch (s) {  
  case "test" :  
  case "test1" :  
    break ;  
  default :  
    break ;  


2, "<>"This thing with the List<String> tempList = new ArrayList<>(); Automatic inference is a generic type instantiation.
3 Grammar support sets, and not necessarily the array
Java code
final List<Integer> piDigits = [ 1,2,3,4,5,8 ];

4 new tools methods of environmental information
Java code
File System.getJavaIoTempDir() // The temporary IO files folder
File System.getJavaHomeDir() // The JRE installation directory
File System.getUserHomeDir() // The current user directory
File System.getUserDir() // The java process is started when the directory


5 Boolean type inversion, null pointer safety in operation,
Java code
Boolean Booleans.negate(Boolean booleanObj)
True => False , False => True, Null => Null
boolean Booleans.and(boolean[] array)
boolean Booleans.or(boolean[] array)
boolean Booleans.xor(boolean[] array)
boolean Booleans.and(Boolean[] array)
boolean Booleans.or(Boolean[] array)
boolean Booleans.xor(Boolean[] array)

6 two char equals
Java code
boolean Character.equalsIgnoreCase(char ch1, char ch2)

7, Safety add, subtract, multiply and divide
Java code
int Math.safeToInt(long value)
int Math.safeNegate(int value)
long Math.safeSubtract(long value1, int value2)
long Math.safeSubtract(long value1, long value2)
int Math.safeMultiply(int value1, int value2)
long Math.safeMultiply(long value1, int value2)
long Math.safeMultiply(long value1, long value2)
long Math.safeNegate(long value)
int Math.safeAdd(int value1, int value2)
long Math.safeAdd(long value1, int value2)
long Math.safeAdd(long value1, long value2)
int Math.safeSubtract(int value1, int value2)

Resources from
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Vanessa at December 07, 2013 - 8:52 AM