Code example for List

Methods: get, isEmpty

0
        this.clusterDescription = clusterDescription;
    } 
 
    public String getName() {
        final List<ServerDescription> any = clusterDescription.getAny();
        return any.isEmpty() ? null : any.get(0).getSetName();
    } 
 
    /** 
     * @return master or null if don't have one 
     * @throws MongoException 
     */ 
    public ServerAddress getMaster() { 
        final List<ServerDescription> primaries = clusterDescription.getPrimaries();
        return primaries.isEmpty() ? null : primaries.get(0).getAddress();
    } 
 
    /** 
     * @param serverAddress the server to compare 
     * @return indication if the ServerAddress is the current Master/Primary 
     * @throws MongoException