- Timestamp:
- 2024-06-12T12:32:03+02:00 (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r19101 r19102 636 636 @SuppressWarnings("unchecked") 637 637 public static <T> List<T> toUnmodifiableList(Collection<T> collection) { 638 // Note: Windows does a `null` check on startup on these lists. See #23717. 639 // Only change this once that is fixed. 640 // Java 9: use List.of(...) 638 641 if (isEmpty(collection)) { 639 642 return Collections.emptyList(); … … 641 644 return Collections.singletonList(collection.iterator().next()); 642 645 } else { 643 // List.copyOf would also work, but if the original collection is immutable, it just returns the original 644 // collection. 645 return (List<T>) List.of(collection.toArray()); 646 return (List<T>) Arrays.asList(collection.toArray()); 646 647 } 647 648 }
Note:
See TracChangeset
for help on using the changeset viewer.