除去具有从ArrayList中给定的字符元素 [英] removing the elements having the given character from the arraylist
本文介绍了除去具有从ArrayList中给定的字符元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在寻找一种方式来搜索特定字符在一个ArrayList的elements.But我找不到any.Could请你帮我一点?
I have been looking for a way to search a given character in an arraylist's elements.But ı couldn't find any.Could you please help me a bit ?
推荐答案
试试这个:
ArrayList<String> listCopy = yourList.clone();
Iterator<String> it = listCopy.iterator();
while(it.hasNext()){
String element = it.next();
if(element.contains(Character.toString(yourChar)){
yourList.remove(element);
}
}
这篇关于除去具有从ArrayList中给定的字符元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文