I am trying to loop through an ArrayList, and compare each index value to a default value, if the index value matches the default value, I want to return true, the only problem is that, it always returns true only to the index item that is added. Since my class doesn't have a main method, I have added those values during the class constructor initialization.
  public class CountryFinderImpl implements CountryFinder{
    List<String> Countries = new ArrayList<String>();
    public CountryFinderImpl() {
        Countries.add("canada");
        Countries.add("japan");
        Countries.add("usa");
    }
    @Override
    public boolean forWeather(String country) {
        // TODO Auto-generated method stub
        country = country.toLowerCase();
        boolean c=false;
                for(int i=0; i<Countries.size();i++) {
                    if(Countries.get(i).equals(country)) {
                        //System.out.println(country+"Weather available");
                        c=true;
                    }else {
                        //System.out.println(country+"weather unavilable");
                        c=false;
                    }
                }
        return c;
    }
}
The country parameter is passed from another class, which takes the country value from the user.
 
    