2012-02-29 64 views

回答

4
  1. 添加委托场Iterator<Integer>implements Iterator<Integer>foo如下:

    public class Foo implements Iterator<Integer> { 
        Iterator<Integer> iterator; 
    } 
    
  2. 选择信号源菜单,然后选择 “生成委托方法”。

  3. 检查迭代器框,然后单击确定。结果代码如下所示(取决于您的格式设置)。

    public class Foo { 
        Iterator<Integer> iterator; 
    
        public boolean hasNext() { return iterator.hasNext(); } 
        public Integer next() { return iterator.next(); } 
        public void remove() { iterator.remove(); } 
    } 
    
相关问题