![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lambda
[纳川]
日拱一卒无有尽,功不唐捐终入海
展开
-
lambda 表达式forEach中获取元素下标
public static void main(String[] args) { ArrayList<String> strings = new ArrayList<>(); strings.add("一"); strings.add("二"); strings.add("三"); Stream.iterate(0, i -> i + 1).limit(strings.size()).for.原创 2020-12-26 11:28:31 · 5563 阅读 · 0 评论 -
lambda表达式常用例子
比较 // 省略参数表的类型 Collections.sort(list, (s1, s2) -> { System.out.println("s1=" + s1); System.out.println("s2=" + s2); if (s1 == null) { return -1; } if (s2 == null) ..原创 2020-07-10 14:23:28 · 736 阅读 · 0 评论