Java 8 的新特性和改进总览
http://www.oschina.net/translate/everything-about-java-8
http://www.techempower.com/blog/2013/03/26/everything-about-java-8/
http://blog.csdn.net/ioriogami/article/details/12782141
//给出一个String类型的数组,找出其中各个素数,并统计其出现次数
public void primaryOccurrence(String... numbers) {
List<String> l = Arrays.asList(numbers);
Map<Integer, Integer> r = l.stream()
.map(e -> new Integer(e))
.filter(e -> Primes.isPrime(e))
.collect( Collectors.groupingBy(p->p, Collectors.summingInt(p->1)) );
System.out.println("primaryOccurrence result is: " + r);
}
Java SE 9版本预计将于2016年年初面世,能够通过Jigsaw项目为Java带来模块化功能机制
时间: 2024-10-06 07:31:40