java

JDK 1.8 Features

Following are JDK 1.8 Features Read one-by-one as they are very innteresting. 1. Method References a) With static method: import java.util.Arrays; class Test { public static int matchStringLength(String str1, String str2) { return str1.length() – str2.length(); } } public class Demo { public void printByStringLength() { String names[] = {“abcde”,”abc”,”ab”,”abcd”, “a”}; Arrays.sort(names, Test::matchStringLength); System.out.println(Arrays.toString(names)); } …

JDK 1.8 Features Read More »