Build count map map.

@param pattern the pattern
@param path    the path
@return the map
180827
public static Map<String, Long> buildCountMap(Pattern pattern, Path path) {
        return buildCountMap(
                JMFiles.getLineStream(path).flatMap(pattern::splitAsStream));
    }
600111
private static SimpleDateFormat buildDateFormat(final String pattern) {

    SimpleDateFormat simpleDateFormat = simpleDateFormatCache.get();
    if (simpleDateFormat == null) {
      simpleDateFormat = new SimpleDateFormat();
      simpleDateFormatCache.set(simpleDateFormat);
    }
    simpleDateFormat.applyPattern(pattern);
    return simpleDateFormat;
  }
41165
public void setPattern(String pattern) throws IllegalArgumentException{
		if (pattern == null) {
			throw new IllegalArgumentException("The pattern must not be null.");
		}

		this.pattern = pattern;
		parsePattern(this.pattern);
	}
161729
public static Format getNumberFormatter(final String pattern) {
		Format format = JKFormatUtil.formatMap.get(pattern);
		if (format == null) {
			format = new DecimalFormat(pattern);
			JKFormatUtil.formatMap.put(pattern, format);
		}
		return format;
	}
488675
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
    protected static String derivePattern(String path) {
        String pattern;
        if ("/".equals(path)) {
            pattern = "/**";
        } else {
            String patternBase = path;
            if (patternBase.endsWith("/")) {
                patternBase = path.substring(0, path.length() - 1);
            }
            pattern = path + "," + path + "/**";
        }
        return pattern;
    }
1084750
private void getCounts(String path, Counts counts) {
        DataNode node = getNode(path);
        if (node == null) {
            return;
        }
        String[] children = null;
        int len = 0;
        synchronized (node) {
            Set<String> childs = node.getChildren();
            if (childs != null) {
                children = childs.toArray(new String[childs.size()]);
            }
            len = (node.data == null ? 0 : node.data.length);
        }
        // add itself
        counts.count += 1;
        counts.bytes += len;
        if (children == null || children.length == 0) {
            return;
        }
        for (String child : children) {
            getCounts(path + "/" + child, counts);
        }
    }
1369491
public static boolean matches(Collection<PathPattern> patterns, List<String> path) {
		for (PathPattern pattern : patterns)
			if (pattern.matches(path))
				return true;
		return false;
	}
520641
private String buildPath(List<String> path) {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < path.size(); i++) {
            if (i > 0) {
                sb.append('.');
            }

            sb.append(path.get(i));
        }

        return sb.toString();
    }
633745
public function getNestedFolderCount( $pattern = NULL )
	{
		$count	= 0;
		foreach( $this->getNestedFolderList( $pattern ) as $entry )
			$count++;
		return $count;
	}
1125233
public static List<Class<? extends WindupVertexFrame>> getMappings(GraphRewrite event, String pattern)
    {
        Map<String, List<Class<? extends WindupVertexFrame>>> mappings = getMappings(event);
        List<Class<? extends WindupVertexFrame>> result = mappings.get(pattern);
        if (result == null)
        {
            result = new ArrayList<>();
            mappings.put(pattern, result);
        }
        return result;
    }
747589
@GetMapping("/count/{type}/{task}")
    public Map<String, Object> count(@PathVariable String type, @PathVariable String task) {
        return count(type, null, task);
    }
66811
public void setPattern(String pattern) {
        if (pattern == null || pattern.length() <= 0) {
            throw new IllegalArgumentException(
                    "Pattern to search for can not be null or of length 0");
        }
        pattern_.text_ = pattern;
        initialize();
    }
1209947
static List<String> parsePattern(String pattern) {
    List<String> parameters = new ArrayList<>(4);
    Matcher matcher = PARAM_REGEX.matcher(pattern);
    while (matcher.find()) {
      parameters.add(matcher.group(1));
    }
    return parameters;
  }
470421
@Nonnegative
    public static int count(@Nonnull final Path dir) throws IOException {
        try (final DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
            return Iterables.size(stream);
        } catch (DirectoryIteratorException ex) {
            // I/O error encounted during the iteration, the cause is an IOException
            throw ex.getCause();
        }
    }
111785
@Override
    public int countMaps(TargetProperties targetMolecule) {
        IState state = new VFState(query, targetMolecule);
        maps.clear();
        mapAll(state);
        return maps.size();
    }
1260769
public boolean find(Pattern pattern)
    {
        matcher.usePattern(pattern);
        int start = matcher.regionStart();
        if (matcher.find())
        {
            stack.add(new MatchResultImpl(matcher));
            matcher.region(matcher.end(), matcher.regionEnd());
            return true;
        }
        else
        {
            return false;
        }
    }
481647
public static <T> Map<T, Integer> countMap(Iterable<T> iter) {
		return countMap(null == iter ? null : iter.iterator());
	}