All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.openbox.server.ServerVisitor Maven / Gradle / Ivy

The newest version!
package com.googlecode.openbox.server;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by jerrycai on 3/29/16.
 */
public class ServerVisitor {

    private Server[] servers;

    private ServerVisitor(Server[] servers) {
        this.servers = servers;
    }

    public static ServerVisitor newIntance(Server[] servers) {
        return new ServerVisitor(servers);
    }

    public interface Action {
        T access(Server server);
    }

    public Map visit(Action action) {
        Map results = new HashMap();
        for (Server server : servers) {
            results.put(server, action.access(server));
        }
        return results;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy