小编niv*_*ard的帖子

多个If条件在Java中使用Iterator

我有一个列表,其中包含元素1到10.我尝试从中删除素数2,3,5,7然后使用iterator打印列表的其余部分.但此代码抛出 NoSuchElementException.这是我的代码:

public static void editerate2(Collection<Integer> list3)
{
    Iterator<Integer> it=list3.iterator();
    while(it.hasNext())
    {
        if(it.next()==2 || it.next()==3 || it.next() ==5 || it.next()==7 ) 
        {
            it.remove();
        }
    }
    System.out.println("List 3:");
    System.out.println("After removing prime numbers  : " + list3);
}
Run Code Online (Sandbox Code Playgroud)

这样做的正确方法是什么?还有什么区别使用"|" 和"||" ???

java collections iterator

0
推荐指数
1
解决办法
2105
查看次数

Android DTMF发送音调覆盖

我尝试以编程方式在Android中发送DTMF音.但是模拟器会显示一个对话框,上面写着"你想发送这些音吗?" 它只在我点击OK时发送音调.但是,我如何以编程方式克服此对话框?

格拉西亚斯

android telephony dtmf

-1
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×1

collections ×1

dtmf ×1

iterator ×1

java ×1

telephony ×1