Android 使用迭代器完成List的遍历并删掉一定条件的数据

版权声明:博主原创文章,转载请注明出处: https://blog.csdn.net/vida990717/article/details/88791863

使用迭代器完成List的遍历并删掉一定条件的数据:

private void initData (List<DataBean> data){
    Iterator<DataBean> iterator = data.iterator();
    while (iterator.hasNext()) {
        DataBean current = iterator.next();
        if(current.getVideoWidth() > current.getVideoHeight()){
            iterator.remove();
        }
    }
}

猜你喜欢

转载自blog.csdn.net/vida990717/article/details/88791863