Remove element from list
程序员文章站
2022-04-18 19:23:24
...
@Test
public void remove_element_from_array_to_arraylist_java8 () {
String[] daysOfWeek = {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"};
List<String> daysOfWeekAsList = Lists.newArrayList(daysOfWeek);
boolean removed = daysOfWeekAsList.removeIf(p -> p.equalsIgnoreCase("Monday"));
logger.info(daysOfWeekAsList);
assertTrue(removed);
assertTrue(daysOfWeekAsList.size() == 6);
}
转载于:https://www.jianshu.com/p/1298b2dc8379
上一篇: List中remove数据
下一篇: System.gc() 的理解
推荐阅读
-
leetcode82: Remove Duplicates from Sorted ListII
-
Java基础学习总结(129)——Arrays.asList得到的List进行add和remove等操作出现异常解析
-
Java list.remove( )方法需要注意的地方
-
详解element上传组件before-remove钩子问题解决
-
Python 删除List元素的三种方法remove、pop、del
-
【一天一道LeetCode】#26. Remove Duplicates from Sorted Array
-
LeetCode 83. Remove Duplicates from Sorted List
-
83. Remove Duplicates from Sorted List
-
LeetCode 83. Remove Duplicates from Sorted List
-
LeetCode 83. Remove Duplicates from Sorted List ***