Changeset 15591 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
r15323 r15591 983 983 984 984 /** 985 * Trim whitespaces from the strings {@code strings}. 986 * 987 * @param strings The list of strings to strip 988 * @return The resulting string 989 * @see Utils#strip 990 * @since 15591 991 */ 992 public static List<String> trim_list(List<String> strings) { 993 return strings.stream().map(Utils::strip).filter(str -> !str.isEmpty()).collect(Collectors.toList()); 994 } 995 996 /** 985 997 * Check if two strings are similar, but not identical, i.e., have a Levenshtein distance of 1 or 2. 986 998 * @param string1 first string to compare -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
r15323 r15591 325 325 } 326 326 327 /** 328 * Test case for {@link Functions#trim_list} 329 */ 330 @Test 331 public void testTrimList() { 332 List<String> trimmed = Functions.trim_list(Arrays.asList(" A1 ", "A2", " A3", "A4 ", "")); 333 assertEquals(4, trimmed.size()); 334 assertEquals("A1", trimmed.get(0)); 335 assertEquals("A2", trimmed.get(1)); 336 assertEquals("A3", trimmed.get(2)); 337 assertEquals("A4", trimmed.get(3)); 338 } 339 327 340 @Test 328 341 public void testTicket8568() throws Exception {
Note:
See TracChangeset
for help on using the changeset viewer.
