[精讚] [會員登入]
497

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

你可能感興趣的文章

Spring Boot Maven wrappers maven, mvnw, build command

ArrayList 與 HashMap 範例 public static void main(String[] args) { String titleIds = &

spring boot jpa 使用多個欄位排序 我有一entity 叫 team 資料欄下如下 @Id @GeneratedValue(strategy = Gener

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

刪除資料夾內的檔案 lambda 一行文 Arrays.stream(new File("/folder/path").

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

隨機好文

tmux 將終端機切割成多個視 窗 tmux, multiple terminal

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

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

編碼的順序 utf8 big5

00-F2 的 IPV6 反解設定 近日, 強者我的大神同事, line 傳來一句: igogo 上次你那個ipv6的設定檔 再幫我跑一次 如連結 程式都寫