美文网首页
Remove element from list

Remove element from list

作者: 抽刀断水2 | 来源:发表于2018-04-29 20:41 被阅读0次
    @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

          本文链接:https://www.haomeiwen.com/subject/atjalftx.html