Changeset 9217 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-12-29T23:51:37+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r9196 r9217 48 48 import java.util.List; 49 49 import java.util.Locale; 50 import java.util.Objects; 50 51 import java.util.concurrent.ExecutorService; 51 52 import java.util.concurrent.Executors; … … 515 516 public static boolean equalsEpsilon(double a, double b) { 516 517 return Math.abs(a - b) <= EPSILON; 518 } 519 520 /** 521 * Determines if two collections are equal. 522 * @param a first collection 523 * @param b second collection 524 * @return {@code true} if collections are equal, {@code false} otherwise 525 * @since 9217 526 */ 527 public static boolean equalCollection(Collection<?> a, Collection<?> b) { 528 if (a == null) return b == null; 529 if (b == null) return false; 530 if (a.size() != b.size()) return false; 531 Iterator<?> itA = a.iterator(); 532 Iterator<?> itB = b.iterator(); 533 while (itA.hasNext()) { 534 if (!Objects.equals(itA.next(), itB.next())) 535 return false; 536 } 537 return true; 517 538 } 518 539
Note:
See TracChangeset
for help on using the changeset viewer.