Changeset 15982 in josm for trunk/src/org/openstreetmap/josm/tools/Utils.java
- Timestamp:
- 2020-03-01T23:35:53+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r15909 r15982 48 48 import java.util.List; 49 49 import java.util.Locale; 50 import java.util.Map; 50 51 import java.util.Optional; 51 52 import java.util.concurrent.ExecutionException; … … 69 70 import javax.script.ScriptEngineManager; 70 71 72 import com.kitfox.svg.xml.XMLParseUtil; 71 73 import org.openstreetmap.josm.spi.preferences.Config; 72 74 … … 766 768 return (List<T>) Arrays.asList(collection.toArray()); 767 769 } 770 } 771 772 /** 773 * Returns an unmodifiable map for the given map. 774 * Makes use of {@link Collections#emptyMap()} and {@link Collections#singletonMap} and {@link Map#ofEntries(Map.Entry[])} to save memory. 775 * 776 * @param map the map for which an unmodifiable map is to be returned 777 * @param <K> the type of keys maintained by this map 778 * @param <V> the type of mapped values 779 * @return an unmodifiable map 780 * @see <a href="https://dzone.com/articles/preventing-your-java-collections-from-wasting-memo"> 781 * How to Prevent Your Java Collections From Wasting Memory</a> 782 */ 783 public static <K, V> Map<K, V> toUnmodifiableMap(Map<K, V> map) { 784 return XMLParseUtil.toUnmodifiableMap(map); 768 785 } 769 786
Note:
See TracChangeset
for help on using the changeset viewer.