Java List Include isAcceptedCountry(String country, List countryInclude, List countryExclude)

Here you can find the source of isAcceptedCountry(String country, List countryInclude, List countryExclude)

Description

Return if a country is accepted

License

Apache License

Parameter

Parameter Description

Declaration

public static boolean isAcceptedCountry(String country, List<String> countryInclude,
        List<String> countryExclude) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    /**/*from  www .j  a v a2  s .co  m*/
     * Return if a country is accepted
     * 
     * @param 
     * @return
     */
    public static boolean isAcceptedCountry(String country, List<String> countryInclude,
            List<String> countryExclude) {
        if (country == null || "".equals(country))
            return true;

        country = country.toLowerCase();

        if (countryInclude != null && countryInclude.size() > 0 && !"".equals(countryInclude.get(0))) {
            if (countryInclude.contains(country))
                return true;
            return false;
        }
        if (countryExclude != null && countryExclude.size() > 0 && !"".equals(countryExclude.get(0))) {
            if (countryExclude.contains(country))
                return false;
            return true;
        }
        return true;
    }
}

Related

  1. addToken(String sequence, String delim, int[] markers, boolean includeDelim, List tokens)
  2. currentPackageIncludedInExcludePatterns(final String fullyQualifiedName, final List excludePatterns)
  3. getPrefixesAndSuffixes(List items, int minSize, int maxSize, T paddingSymbol, boolean includePrefixes, boolean includeSuffixes)
  4. isIncluded(List list, String src)
  5. isIndexable(String filename, List includes, List excludes)
  6. isIndexable(String key, List includes, List excludes)