client.java

来自「《JAVA与模式》附书中源代码」· Java 代码 · 共 32 行

JAVA
32
字号
package com.javapatterns.iterator.blackbox;

public class Client
{
    /**
     * @directed 
     */
    private Iterator it;

    /**
     * @directed 
     */
    private Aggregate agg = new ConcreteAggregate();

    public void operation()
    {
        it = agg.createIterator();

        while( !it.isDone() )
        {
			System.out.println(it.currentItem().toString());
            it.next();
        }
    }

    public static void main(String[] args)
    {
        Client client = new Client();
		client.operation();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?