@Test public void testFilterByGlobPattern() throws Exception { Collection<String> values = new ArrayList<String>(); values.add("abc123"); values.add("JQKxyz"); values.add("abc123"); values.add("abcLLL"); Set<String> filter = ParseUtils.filterByGlobPattern("abc*", values); Set<String> expected = new HashSet<String>(); expected.add("abc123"); expected.add("abcLLL"); assertEquals(expected, filter); filter = ParseUtils.filterByGlobPattern((Collection<String>)null, values); assertTrue(filter.isEmpty()); Collection<String> patterns = new ArrayList<String>(); patterns.add("000000000"); patterns.add("abc*"); patterns.add("*xyz"); filter = ParseUtils.filterByGlobPattern(patterns, values); expected.add("JQKxyz"); assertEquals(expected, filter); }
public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if(pattern == null || values == null) { return ret; } for(String v : values) { if(isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; }
ParseUtils { public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if(pattern == null || values == null) { return ret; } for(String v : values) { if(isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } }
ParseUtils { public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if(pattern == null || values == null) { return ret; } for(String v : values) { if(isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } private  ParseUtils(); }
ParseUtils { public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if(pattern == null || values == null) { return ret; } for(String v : values) { if(isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } private  ParseUtils(); static String interpolate(String expression, Map<String, String> params); static List<String> interpolate(List<String> expressions, Map<String, String> params); static boolean isMatchGlobPattern(String pattern, String value); static boolean isMatchGlobPatternsNeedInterpolate(
            Collection<String> patternsNeedInterpolate,
            Map<String, String> interpolateParams, String value); static Set<String> filterByGlobPattern(String pattern, Collection<String> values); static Set<String> filterByGlobPattern(Collection<String> patterns, Collection<String> values); static boolean hasIntersection(String glob1, String glob2); static Map<String, String> parseQuery(String keyPrefix, String query); static Map<String, String> parseQuery(String query); static String replaceParameter(String query, String key, String value); static String appendParamToUri(String uri, String name, String value); static String appendParamsToUri(String uri, Map<String, String> params); static boolean matchEndStarPattern(String value, String pattern); }
ParseUtils { public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if(pattern == null || values == null) { return ret; } for(String v : values) { if(isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } private  ParseUtils(); static String interpolate(String expression, Map<String, String> params); static List<String> interpolate(List<String> expressions, Map<String, String> params); static boolean isMatchGlobPattern(String pattern, String value); static boolean isMatchGlobPatternsNeedInterpolate(
            Collection<String> patternsNeedInterpolate,
            Map<String, String> interpolateParams, String value); static Set<String> filterByGlobPattern(String pattern, Collection<String> values); static Set<String> filterByGlobPattern(Collection<String> patterns, Collection<String> values); static boolean hasIntersection(String glob1, String glob2); static Map<String, String> parseQuery(String keyPrefix, String query); static Map<String, String> parseQuery(String query); static String replaceParameter(String query, String key, String value); static String appendParamToUri(String uri, String name, String value); static String appendParamsToUri(String uri, Map<String, String> params); static boolean matchEndStarPattern(String value, String pattern); static String METHOD_SPLIT; }