I would like to return the Host thats have the same domain as the Host in the List. But it gives me and error: "This method have to return a type of Host".
How I have to return the object Host?
public class Manager {
private List<Host> hosts = new ArrayList<Host>();
public Host getHost (String domain) {
for(int i = 0; i < hosts.size(); i++) {
if(domain == hosts.get(i).getDomain()) {
return hosts.get(i);
}}
}
Thanks.