Ignore:
Timestamp:
2016-09-17T23:28:38+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - pmd:OptimizableToArrayCall - Optimizable To Array Call

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r10791 r11017  
    172172            build();
    173173            lblMessage.setText(msg);
    174             lstLayers.setListData(infos.toArray(new SaveLayerInfo[0]));
     174            lstLayers.setListData(infos.toArray(new SaveLayerInfo[infos.size()]));
    175175        }
    176176
  • trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java

    r10990 r11017  
    7777        ret.add(new LayerSaveAsAction(this));
    7878        ret.add(new BookmarkWmsAction());
    79         return ret.toArray(new Action[]{});
     79        return ret.toArray(new Action[ret.size()]);
    8080    }
    8181
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r10938 r11017  
    416416            Collections.sort(vtTimezones);
    417417
    418             JosmComboBox<String> cbTimezones = new JosmComboBox<>(vtTimezones.toArray(new String[0]));
     418            JosmComboBox<String> cbTimezones = new JosmComboBox<>(vtTimezones.toArray(new String[vtTimezones.size()]));
    419419
    420420            String tzId = Main.pref.get("geoimage.timezoneid", "");
     
    567567        panelCb.add(new JLabel(tr("GPX track: ")));
    568568
    569         cbGpx = new JosmComboBox<>(gpxLst.toArray(new GpxDataWrapper[0]));
     569        cbGpx = new JosmComboBox<>(gpxLst.toArray(new GpxDataWrapper[gpxLst.size()]));
    570570        if (defaultItem != null) {
    571571            cbGpx.setSelectedItem(defaultItem);
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java

    r10364 r11017  
    123123            return null;
    124124        }
    125         return AbstractMergeAction.askTargetLayer(targetLayers.toArray(new AbstractTileSourceLayer[0]),
     125        return AbstractMergeAction.askTargetLayer(targetLayers.toArray(new AbstractTileSourceLayer[targetLayers.size()]),
    126126                tr("Please select the imagery layer."),
    127127                tr("Select imagery layer"),
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java

    r10634 r11017  
    77import java.net.MalformedURLException;
    88import java.net.URL;
     9import java.util.List;
    910
    1011import javax.swing.DefaultComboBoxModel;
     
    7374                wms.attemptGetCapabilities(rawUrl.getText());
    7475                tree.updateTree(wms);
    75                 formats.setModel(new DefaultComboBoxModel<>(wms.getFormats().toArray(new String[0])));
     76                List<String> wmsFormats = wms.getFormats();
     77                formats.setModel(new DefaultComboBoxModel<>(wmsFormats.toArray(new String[wmsFormats.size()])));
    7678                formats.setSelectedItem(wms.getPreferredFormats());
    7779            } catch (MalformedURLException ex1) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java

    r10619 r11017  
    9292            filter.getDocument().addDocumentListener(this);
    9393
    94             selectionList = new JList<>(data.toArray(new String[0]));
     94            selectionList = new JList<>(data.toArray(new String[data.size()]));
    9595            selectionList.setModel(model);
    9696            JScrollPane scroll = new JScrollPane(selectionList);
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java

    r10611 r11017  
    22package org.openstreetmap.josm.gui.preferences.projection;
    33
     4import static org.openstreetmap.josm.data.SystemOfMeasurement.ALL_SYSTEMS;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    56
     
    271272    private static final CollectionProperty PROP_SUB_PROJECTION = new CollectionProperty("projection.sub", null);
    272273    public static final StringProperty PROP_SYSTEM_OF_MEASUREMENT = new StringProperty("system_of_measurement", "Metric");
    273     private static final String[] unitsValues = (new ArrayList<>(SystemOfMeasurement.ALL_SYSTEMS.keySet())).toArray(new String[0]);
     274    private static final String[] unitsValues = ALL_SYSTEMS.keySet().toArray(new String[ALL_SYSTEMS.size()]);
    274275    private static final String[] unitsValuesTr = new String[unitsValues.length];
    275276    static {
     
    282283     * Combobox with all projections available
    283284     */
    284     private final JosmComboBox<ProjectionChoice> projectionCombo = new JosmComboBox<>(projectionChoices.toArray(new ProjectionChoice[0]));
     285    private final JosmComboBox<ProjectionChoice> projectionCombo = new JosmComboBox<>(
     286            projectionChoices.toArray(new ProjectionChoice[projectionChoices.size()]));
    285287
    286288    /**
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java

    r9543 r11017  
    4444     */
    4545    public UTMProjectionChoice() {
    46         super(tr("UTM"), /* NO-ICON */ "core:utm", cbEntries.toArray(new String[0]), tr("UTM Zone"));
     46        super(tr("UTM"), /* NO-ICON */ "core:utm", cbEntries.toArray(new String[cbEntries.size()]), tr("UTM Zone"));
    4747    }
    4848
  • trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java

    r10853 r11017  
    225225        cbAlt.setText(ALT); // see above for why no tr()
    226226        tfKey.setAction(action);
    227         tfKey.setModel(new DefaultComboBoxModel<>(keyList.values().toArray(new String[0])));
     227        tfKey.setModel(new DefaultComboBoxModel<>(keyList.values().toArray(new String[keyList.size()])));
    228228        cbMeta.setAction(action);
    229229        cbMeta.setText(META); // see above for why no tr()
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Combo.java

    r9665 r11017  
    4949        }
    5050
    51         combobox = new JosmComboBox<>(lhm.values().toArray(new PresetListEntry[0]));
     51        combobox = new JosmComboBox<>(lhm.values().toArray(new PresetListEntry[lhm.size()]));
    5252        component = combobox;
    5353        combobox.setRenderer(getListCellRenderer());
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelect.java

    r10670 r11017  
    2626    @Override
    2727    protected void addToPanelAnchor(JPanel p, String def, boolean presetInitiallyMatches) {
    28         list = new ConcatenatingJList(delimiter, lhm.values().toArray(new PresetListEntry[0]));
     28        list = new ConcatenatingJList(delimiter, lhm.values().toArray(new PresetListEntry[lhm.size()]));
    2929        component = list;
    3030        ListCellRenderer<PresetListEntry> renderer = getListCellRenderer();
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java

    r10626 r11017  
    106106        } else {
    107107            // the objects have different values
    108             JosmComboBox<String> comboBox = new JosmComboBox<>(usage.values.toArray(new String[0]));
     108            JosmComboBox<String> comboBox = new JosmComboBox<>(usage.values.toArray(new String[usage.values.size()]));
    109109            comboBox.setEditable(true);
    110110            comboBox.setEditor(textField);
  • trunk/src/org/openstreetmap/josm/gui/widgets/NativeFileChooser.java

    r11015 r11017  
    5656        // https://bugs.openjdk.java.net/browse/JDK-4811090 : Extend awt filedialog
    5757        // https://bugs.openjdk.java.net/browse/JDK-6192906 : Add more features to java.awt.FileDialog
    58         return fileFilters.toArray(new FileFilter[0]);
     58        return fileFilters.toArray(new FileFilter[fileFilters.size()]);
    5959    }
    6060
Note: See TracChangeset for help on using the changeset viewer.