设计模式——迭代器模式(Iterator) 用户6236020498776 2022-04-07 48 阅读1分钟 让用户通过特定的接口访问容器的数据,不需要了解容器内部的数据结构。 public interface Iterator { boolean hasNext(); E next(); default void remove() { throw new UnsupportedOperationException(); } } public interface Iterable < E > { Iterator < E > createIterator() ; }