首页 > 编程语言 > 详细

Java Iterable Iterator zz

时间:2014-11-28 15:50:27      阅读:247      评论:0      收藏:0      [点我收藏+]

http://stackoverflow.com/questions/6863182/what-is-the-difference-between-iterator-and-iterable-and-how-to-use-them

Iterator is an interface, which has implementation for iterate over elements. Iterable is an interface which provides Iterator.

 

An implementation of Iterable is one that provides an Iterator of itself:

public interface Iterable<T>
{
    Iterator<T> iterator();
}

 

An iterator is a simple way of allowing some to loop through a collection of data without assignment privileges (though with ability to remove).

public interface Iterator<E>
{
    boolean hasNext();
    E next();
    void remove();
}

 

Java Iterable Iterator zz

原文:http://www.cnblogs.com/majia1949/p/4128409.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!