- Timestamp:
- 2021-07-11T04:31:05+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java
r14153 r17998 2 2 package org.openstreetmap.josm.gui.dialogs; 3 3 4 import static java.util.Collections.emptyList; 5 import static java.util.stream.Collectors.toCollection; 4 6 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 5 7 import static org.openstreetmap.josm.tools.I18n.tr; … … 9 11 import java.awt.event.ActionEvent; 10 12 import java.util.ArrayList; 11 import java.util.Arrays;12 import java.util.Collections;13 13 import java.util.List; 14 import java.util.stream.Stream; 14 15 15 16 import javax.swing.AbstractAction; … … 82 83 if (selectedLayers.size() == 1) { 83 84 Action[] entries = selectedLayers.get(0).getMenuEntries(); 84 actions = entries != null ? Arrays.asList(entries) : Collections.emptyList(); 85 // Since we may add to the array later, we cannot use Arrays.asList -- it prohibits the use of `add` or `remove`. 86 actions = entries != null ? Stream.of(entries).collect(toCollection(ArrayList::new)) : emptyList(); 85 87 } else { 86 88 // Very simple algorithm - first selected layer has actions order as in getMenuEntries, actions from other layers go to the end
Note:
See TracChangeset
for help on using the changeset viewer.