首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Java > 在功能性风格的java集合操作

在功能性风格的java集合操作

  • 资源大小:629.82 kB
  • 上传时间:2021-06-29
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: java 操作 风格 功能性

资 源 简 介

Unfortunately, java 1.6 does not provide opportunities for functional programming. Also, there are no opportunities for simple expansion of the language. However, we can use other methods for implementing the elements of functional programming in java. The following code shows an example of using the library listfunc4j. @Test public void testForEach() throws Exception { List < Long > myList = Arrays.asList(0L, 1L, 2L, 3L); final int x = 100; forEach(myList) .add(new Lambda() {{ _ = $.intValue(); }}) .add(new Lambda() {{ System.out.println("test " + (_ = $)); }}) .filter(new Filter() {{ _ = ($ > 0); }}) .update(new Updater() {{ System.out.println("more than 0: " + $); }}) .aggregate(new Aggregator(0){{ _ += $; }}) .update(new Updater() {{ System.out.pr
VIP VIP
0.173592s