码迷,mamicode.com
首页 > 编程语言 > 详细

Java Iterable Iterator zz

时间:2014-11-28 15:51:39      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   io   color   sp   java   for   

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

标签:des   style   blog   http   io   color   sp   java   for   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!