Remove specific string from arraylist elements containing a particular subsrtring

后端 未结 5 668
我寻月下人不归
我寻月下人不归 2021-01-24 15:00

Here is my code for arrayList ,

 String[] n = new String[]{\"google\",\"microsoft\",\"apple\"};
      final List list =  new ArrayList

        
5条回答
  •  梦谈多话
    2021-01-24 15:51

    Yes, you have to loop from all the values in the list,
    This may help you,

        String[] array  = new String[]{"google","microsoft","apple"};
        List finallist =  new ArrayList();
        for (int i = array.length -1 ; i >= 0 ; i--) 
        {
            if(!array[i].contains("le"))
                finallist.add(array[i]);
        }
    

提交回复
热议问题