Changeset 15323 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
r15317 r15323 555 555 * @since 15279 556 556 */ 557 public static List<String> sort(String... sortables) { 557 public static List<String> sort(String... sortables) { // NO_UCD (unused code) 558 558 Arrays.parallelSort(sortables); 559 559 return Arrays.asList(sortables); … … 566 566 * @since 15279 567 567 */ 568 public static List<String> sort_list(List<String> sortables) { 568 public static List<String> sort_list(List<String> sortables) { // NO_UCD (unused code) 569 569 Collections.sort(sortables); 570 570 return sortables; 571 } 572 573 /** 574 * Get unique values 575 * @param values A list of values that may have duplicates 576 * @return A list with no duplicates 577 * @since 15323 578 */ 579 public static List<String> uniq(String... values) { // NO_UCD (unused code) 580 return uniq_list(Arrays.asList(values)); 581 } 582 583 /** 584 * Get unique values 585 * @param values A list of values that may have duplicates 586 * @return A list with no duplicates 587 * @since 15323 588 */ 589 public static List<String> uniq_list(List<String> values) { 590 return values.stream().distinct().collect(Collectors.toList()); 571 591 } 572 592 -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
r15315 r15323 466 466 467 467 @Test 468 public void testUniqueValues() throws Exception { 469 assertEquals(Arrays.asList(new String[] {"alpha", "beta"}), 470 Functions.uniq("alpha", "alpha", "alpha", "beta")); 471 assertEquals(Arrays.asList(new String[] {"one", "two", "three"}), 472 Functions.uniq_list(Arrays.asList(new String[] {"one", "one", "two", "two", "two", "three"}))); 473 } 474 475 @Test 468 476 public void testCountRoles() throws Exception { 469 477 DataSet ds = new DataSet();
Note:
See TracChangeset
for help on using the changeset viewer.