论坛
提问
用户
提问
×
游客
登录
注册
忘记密码?
为什么我不能在Java枚举上使用foreach循环?
论坛
为什么我不能在Java枚举上使用foreach循环?
18 浏览
2023年3月7日
匿名的
2023年3月7日
0
Comments
为什么我不能在Java枚举上使用foreach循环?
为什么不能这样做:
Enumeration e = ... for (Object o : e) ...
0
0
答案
活跃
已投票
最新
最老的
用户名或电子邮箱地址
密码
注册
Lost Password
为什么枚举不是可迭代的?
为什么Java不允许在迭代器上使用foreach(只能在可迭代对象上使用)?
在Java 8中,为什么没有将数组赋予Iterable的forEach方法?
对于int循环的foreach循环——为什么在删除元素时foreach会引发异常?
为什么在Java的for-each循环中需要变量的声明
为什么在java.utils中,枚举(Enumeration)被转换为ArrayList而不是List?
在Java中循环枚举值的for循环
Java: 为什么Collection.addAll不能接受Iterables?
为什么在Java中不能将一个类声明为静态的?
为什么Java不允许在枚举中重写equals(Object)方法?
如何使我的类可迭代,以便可以使用foreach语法?
ConcurrentModificationException在foreach循环中。
为什么增强型for循环的局部变量必须是局部的?
java - 迭代一个链表
为什么Java不允许接口中使用私有成员?
为什么在foreach循环中对迭代变量进行赋值不会改变底层数据?
Java 的“for each”循环是如何工作的?
为什么Java编译器在使用foreach与原始类型时会发出警告?
为什么Java没有复制构造函数?
性能:在Java中迭代遍历一个列表