Ticket #18166: filter.diff

File filter.diff, 1.0 KB (added by francians, 6 years ago)
  • src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java

    diff --git a/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java b/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
    index a14810572..dead2a43d 100644
    a b public final class Functions {  
    11751175    public static boolean at(Environment env, double lat, double lon) { // NO_UCD (unused code)
    11761176        return new LatLon(lat, lon).equalsEpsilon(center(env));
    11771177    }
     1178
     1179    /**
     1180     * Test wheather each element of the list {@code lst} matches the regular expression {@code regexp}.
     1181     * @param regexp String
     1182     * @param lst list
     1183     * @return list of matches
     1184     * @since xxx
     1185     */
     1186    public static List<String> filter(String regexp, List<String> lst) { // NO_UCD (unused code)
     1187        List<String> dst = new ArrayList<String>();
     1188        for (String str : lst) {
     1189            if (str.matches(regexp)) {
     1190                dst.add(str);
     1191            }
     1192        }
     1193        return dst;
     1194    }
    11781195}