Ticket #18126: contains.patch

File contains.patch, 1.1 KB (added by francians, 6 years ago)
  • src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    diff --git a/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java b/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
    index 2a9bb5147..74efeef3a 100644
    a b public final class ExpressionFactory {  
    244244            return null;
    245245        }
    246246
     247        /**
     248         * Test wheather the list {@code lst} contains the {@code str} element.
     249         * @param lst list
     250         * @param str String
     251         * @return true if {@code str} is contained
     252         */
     253        public static boolean contains(String str, List<?> lst) { // NO_UCD (unused code)
     254            for (int i = 0; i < lst.size(); i++) {
     255                if (lst.get(i).equals(str)) {
     256                    return true;
     257                }
     258            }
     259            return false;
     260        }
     261
    247262        /**
    248263         * Splits string {@code toSplit} at occurrences of the separator string {@code sep} and returns a list of matches.
    249264         * @param sep separator string