@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);
}
Remove element from list
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- LeetCode 26. Remove Duplicates from Sorted Array Given a ...
- 27. Remove Element Given an array and a value, remove all...
- Q: Given a linked list, remove the nth node from the end ...
- Remove the Nth Node from end of List Given linked list: 1...
- Problem: Remove Nth Node From End of List and return its ...