[精讚] [會員登入]
514

ArrayList 想移除特定值

想移出water, 使用lambda 的方式如下 List<String> fruits = new Arr

分享此文連結 //n.sfs.tw/13242

分享連結 ArrayList 想移除特定值@igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-04-11 11:32:40 最後編修
2019-04-11 11:49:56 By igogo
 

 

想移出water,  使用lambda 的方式如下


    List<String> fruits = new ArrayList<>();
        Arrays.asList("apple", "orange","water").forEach(fruit -> fruits.add(fruit));
      

        (fruits.stream()
                .filter(item -> !item.equals("water"))
                .collect(Collectors.toList())
        ).forEach(fruit -> System.out.println(fruit));

 

END

你可能感興趣的文章

讀取特定資料夾下的xls檔 讀取特定資料夾下的xls檔

keycloak 透過java client lib新增user 使用keycloak-admin-client lib maven <dependency> <gro

停止多執行緒 利用主程式呼叫多執行緒時, 要怎麼停止正在執行的多執行緒

使用poi 解析 docx 原先是想解析出在docx 中的文字跟圖片, 但是, 有些我們認為是圖片, 其實是用方程式表示, 實在是太麻煩了 就記錄一

java-身份証字號驗証 FormatCheck.java public class FormatCheck { private volatile

Spring Boot Maven wrappers maven, mvnw, build command

隨機好文

[vue.js] 設定 content type 今天在wickt 端怎麼就是收不到vue.js 以post 傳過來的資料 找了好久才發現 application/jso

download a file from spring boot controllers ownload a file from spring boot controllers

centos 7 移机出現 dracut-initqueue timeout centos 7 移机出現 dracut-initqueue timeout 處理

apache 反向代理 80轉443轉8080 apache, proxy pass

proxmox lxc 救援 今天突然接到一名強者我朋友的臨時求援 他說他把pve 從5.1升到5.2後, kvm的虛擬机器都沒問題 , 但是lxc的