Redian新闻
>
Why java.lang.Iterable depends on java.util.Iterator
avatar
Why java.lang.Iterable depends on java.util.Iterator# Java - 爪哇娇娃
Y*G
1
Should java.lang not depend on anything else? Why Iterator not in java.lang
package?
package java.lang;
import java.util.Iterator;
/**
* Implementing this interface allows an object to be the target of
* the "foreach" statement.
*
* @param the type of elements returned by the iterator
*
* @since 1.5
*/
public interface Iterable {
/**
* Returns an iterator over a set of elements of type T.
*
* @return an Iterator.
*/
Iterator iterator();
}
avatar
g*g
2
Does it matter? As long as it's part of JDK, it will load.

lang

【在 Y**G 的大作中提到】
: Should java.lang not depend on anything else? Why Iterator not in java.lang
: package?
: package java.lang;
: import java.util.Iterator;
: /**
: * Implementing this interface allows an object to be the target of
: * the "foreach" statement.
: *
: * @param the type of elements returned by the iterator
: *

avatar
Y*G
3
It does not matter if you just want to use JDK.
We are trying to hack JDK to come up with some striped down version, as long
as our small app can run on top of it, we want to cut unnecessary classes(
even for those classes in JDK) as much as possible to make our runtime as
small as possible.

【在 g*****g 的大作中提到】
: Does it matter? As long as it's part of JDK, it will load.
:
: lang

avatar
g*g
4
JDK isn't written with that in mind. And the value is little in today's
world.

long

【在 Y**G 的大作中提到】
: It does not matter if you just want to use JDK.
: We are trying to hack JDK to come up with some striped down version, as long
: as our small app can run on top of it, we want to cut unnecessary classes(
: even for those classes in JDK) as much as possible to make our runtime as
: small as possible.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。