@@ -0,0 +1,1086 @@
+// --------------------- %E8%BF%AD%E4%BB%A3%E5%99%A8%E6%8E%A5%E5%8F%A3%0A%0Apublic interface Iterator %7B%0A    Object next();%0A    boolean hasNext();%0A    void remove();%0A%7D%0A%0A// --------------------- %E5%85%B7%E4%BD%93%E8%BF%AD%E4%BB%A3%E5%99%A8%E7%B1%BB%0A%0Apublic class ConcreteIterator implements Iterator %7B%0A    private Vector vector = null;%0A    private int index = 0;%0A%0A    public ConcreteIterator(Vector vector) %7B%0A        this.vector = vector;%0A    %7D%0A%0A    public Object next() %7B%0A        Object result = null;%0A%0A        if (this.index %3C vector.size()) %7B%0A            result = vector.get(index++);%0A        %7D%0A        return result;%0A    %7D%0A%0A    public boolean hasNext() %7B%0A        if (this.index %3C vector.size()) %7B%0A            return true;%0A        %7D%0A        else %7B%0A            return false;%0A        %7D%0A    %7D%0A%0A    public void remove() %7B%0A        vector.remove(index);%0A    %7D%0A%7D%0A%0A// --------------------- test code%0A%0Apublic static void main(String%5B%5D args) %7B%0A    Vector vector = new Vector();%0A%0A    vector.add(%22hello%22);%0A    vector.add(%22luoxn28%22);%0A    vector.add(%22come on%22);%0A%0A    Iterator iter = new ConcreteIterator(vector);%0A    while (iter.hasNext()) %7B%0A        System.out.println(iter.next());%0A    %7D%0A%7D

add iterator pattern