Java List Include isIncluded(List list, String src)

Here you can find the source of isIncluded(List list, String src)

Description

Checks if is included.

License

Open Source License

Parameter

Parameter Description
list the list
src the src

Return

true, if is included

Declaration

public static boolean isIncluded(List<String> list, String src) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**//from   ww w . j  a  va  2  s.  c  o  m
     * Checks if is included.
     *
     * @param list the list
     * @param src the src
     * @return true, if is included
     */
    public static boolean isIncluded(List<String> list, String src) {
        return isIncluded(list, src, true);
    }

    /**
     * Checks if is included.
     *
     * @param list the list
     * @param src the src
     * @param strict the strict
     * @return true, if is included
     */
    public static boolean isIncluded(List<String> list, String src,
            boolean strict) {
        if (list == null)
            return true;

        // filter by known source if
        if (strict)
            return list.contains(src);

        // else look at substring
        for (String s : list) {
            if (src.contains(s))
                return true;
        }

        return false;
    }
}

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. isAcceptedCountry(String country, List countryInclude, List countryExclude)
  5. isIndexable(String filename, List includes, List excludes)
  6. isIndexable(String key, List includes, List excludes)