Changeset 15716 in josm for trunk/src/org


Ignore:
Timestamp:
2020-01-18T14:13:56+01:00 (7 years ago)
Author:
simon04
Message:

Java 8: use String.join

Location:
trunk/src/org/openstreetmap/josm
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java

    r15424 r15716  
    395395        }
    396396        return new ExtensionFileFilter(
    397             Utils.join(",", extensionsPlusArchive),
     397            String.join(",", extensionsPlusArchive),
    398398            defaultExtension,
    399399            description + (!extensionsForDescription.isEmpty()
    400                 ? (" (" + Utils.join(", ", extensionsForDescription) + ')')
     400                ? (" (" + String.join(", ", extensionsForDescription) + ')')
    401401                : "")
    402402            );
  • trunk/src/org/openstreetmap/josm/data/osm/BBox.java

    r15486 r15716  
    33
    44import java.awt.geom.Rectangle2D;
    5 import java.util.Arrays;
    65import java.util.Objects;
    76
    … …  
    109import org.openstreetmap.josm.data.coor.LatLon;
    1110import org.openstreetmap.josm.data.coor.QuadTiling;
    12 import org.openstreetmap.josm.tools.Utils;
    1311
    1412/**
    … …  
    394392     */
    395393    public String toStringCSV(String separator) {
    396         return Utils.join(separator, Arrays.asList(
     394        return String.join(separator,
    397395                LatLon.cDdFormatter.format(xmin),
    398396                LatLon.cDdFormatter.format(ymin),
    399397                LatLon.cDdFormatter.format(xmax),
    400                 LatLon.cDdFormatter.format(ymax)));
     398                LatLon.cDdFormatter.format(ymax));
    401399    }
    402400}
  • trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java

    r15007 r15716  
    2323
    2424import org.openstreetmap.josm.tools.Logging;
    25 import org.openstreetmap.josm.tools.Utils;
    2625
    2726/**
    … …  
    710709            }
    711710        }
    712         return Utils.join(";", values);
     711        return String.join(";", values);
    713712    }
    714713
  • trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java

    r14436 r15716  
    2121import org.openstreetmap.josm.data.coor.conversion.LatLonParser;
    2222import org.openstreetmap.josm.tools.OptionParser;
    23 import org.openstreetmap.josm.tools.Utils;
    2423
    2524/**
    … …  
    7170            }
    7271        }
    73         String fromStr = Utils.join(" ", projParamFrom);
    74         String toStr = Utils.join(" ", projParamTo);
     72        String fromStr = String.join(" ", projParamFrom);
     73        String toStr = String.join(" ", projParamTo);
    7574        try {
    7675            run(fromStr, toStr, otherPositional);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r15682 r15716  
    559559            } else {
    560560                /* I18N: {0} is the test error message and {1} is an alternative */
    561                 return tr("{0}, use {1} instead", getMessage(p), Utils.join(tr(" or "), alternatives));
     561                return tr("{0}, use {1} instead", getMessage(p), String.join(tr(" or "), alternatives));
    562562            }
    563563        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java

    r14302 r15716  
    55import static org.openstreetmap.josm.tools.I18n.trn;
    66
    7 import java.util.Arrays;
    87import java.util.List;
    98
    … …  
    2625import org.openstreetmap.josm.tools.Geometry;
    2726import org.openstreetmap.josm.tools.Pair;
    28 import org.openstreetmap.josm.tools.Utils;
    2927import org.openstreetmap.josm.tools.date.DateUtils;
    3028
    … …  
    256254     */
    257255    private static String toStringCSV(String separator, ILatLon ll) {
    258         return Utils.join(separator, Arrays.asList(
     256        return String.join(separator,
    259257                DecimalDegreesCoordinateFormat.INSTANCE.latToString(ll),
    260258                DecimalDegreesCoordinateFormat.INSTANCE.lonToString(ll)
    261         ));
     259        );
    262260    }
    263261
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

    r14120 r15716  
    6161
    6262        pnl.add(new HtmlPanel(
    63                 Utils.join("<br/>", Arrays.asList(
     63                String.join("<br/>",
    6464                        tr("Enter the coordinates for the new node."),
    6565                        tr("You can separate longitude and latitude with space, comma or semicolon."),
    … …  
    6767                        tr("For South and West cardinal directions you can use either negative numbers or S, W characters."),
    6868                        tr("Coordinate value can be in one of three formats:")
    69                       )) +
     69                      ) +
    7070                Utils.joinAsHtmlUnorderedList(Arrays.asList(
    7171                        tr("<i>degrees</i><tt>&deg;</tt>"),
    … …  
    7373                        tr("<i>degrees</i><tt>&deg;</tt> <i>minutes</i><tt>&#39;</tt> <i>seconds</i><tt>&quot</tt>")
    7474                      )) +
    75                 Utils.join("<br/><br/>", Arrays.asList(
     75                String.join("<br/><br/>",
    7676                        tr("Symbols <tt>&deg;</tt>, <tt>&#39;</tt>, <tt>&prime;</tt>, <tt>&quot;</tt>, <tt>&Prime;</tt> are optional."),
    7777                        tr("You can also use the syntax <tt>lat=\"...\" lon=\"...\"</tt> or <tt>lat=''...'' lon=''...''</tt>."),
    7878                        tr("Some examples:")
    79                       )) +
     79                      ) +
    8080                "<table><tr><td>" +
    8181                Utils.joinAsHtmlUnorderedList(Arrays.asList(
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r15567 r15716  
    854854                    lines.add(sc.getKeyText() + ' ' + tr("to add first suggestion without closing the dialog"))
    855855            );
    856             final JLabel helpLabel = new JLabel("<html>" + Utils.join("<br>", lines) + "</html>");
     856            final JLabel helpLabel = new JLabel("<html>" + String.join("<br>", lines) + "</html>");
    857857            helpLabel.setFont(helpLabel.getFont().deriveFont(Font.PLAIN));
    858858            contentPane.add(helpLabel, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(5, 5, 5, 5));
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r15456 r15716  
    324324        Collection<String> nativeProjections = getNativeProjections();
    325325        if (nativeProjections != null) {
    326             content.add(Arrays.asList(tr("Native projections"), Utils.join(", ", getNativeProjections())));
     326            content.add(Arrays.asList(tr("Native projections"), String.join(", ", getNativeProjections())));
    327327        }
    328328        EastNorth offset = getDisplaySettings().getDisplacement();
  • trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java

    r14155 r15716  
    3434import org.openstreetmap.josm.tools.CheckParameterUtil;
    3535import org.openstreetmap.josm.tools.Logging;
    36 import org.openstreetmap.josm.tools.Utils;
    3736
    3837/**
    … …  
    182181        Logging.info(tr("Reprojecting layer {0} from {1} to {2}. For best image quality and performance,"
    183182                + " switch to one of the supported projections: {3}",
    184                 getName(), proj.toCode(), ProjectionRegistry.getProjection().toCode(), Utils.join(", ", getNativeProjections())));
     183                getName(), proj.toCode(), ProjectionRegistry.getProjection().toCode(), String.join(", ", getNativeProjections())));
    185184        return proj;
    186185    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java

    r15591 r15716  
    318318     * @param args arguments. First one is used as separator
    319319     * @return assembled string
    320      * @see Utils#join
     320     * @see String#join
    321321     */
    322322    @NullableArguments
    323323    public static String join(String... args) { // NO_UCD (unused code)
    324         return Utils.join(args[0], Arrays.asList(args).subList(1, args.length));
     324        return String.join(args[0], Arrays.asList(args).subList(1, args.length));
    325325    }
    326326
    … …  
    330330     * @param values collection of objects
    331331     * @return assembled string
    332      * @see Utils#join
     332     * @see String#join
    333333     */
    334334    public static String join_list(final String separator, final List<String> values) { // NO_UCD (unused code)
    335         return Utils.join(separator, values);
     335        return String.join(separator, values);
    336336    }
    337337
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r15259 r15716  
    11111111                        tr("Ignore warning and install style anyway"));
    11121112                    dlg.setContent("<html>" + tr("Some entries have unmet dependencies:") +
    1113                             "<br>" + Utils.join("<br>", messages) + "</html>");
     1113                            "<br>" + String.join("<br>", messages) + "</html>");
    11141114                    dlg.setIcon(JOptionPane.WARNING_MESSAGE);
    11151115                    if (dlg.showDialog().getValue() != 2)
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java

    r15587 r15716  
    1717import java.lang.reflect.InvocationTargetException;
    1818import java.util.ArrayList;
    19 import java.util.Arrays;
    2019import java.util.Collection;
    2120import java.util.Collections;
    … …  
    6564import org.openstreetmap.josm.tools.ImageProvider;
    6665import org.openstreetmap.josm.tools.Logging;
    67 import org.openstreetmap.josm.tools.Utils;
    6866
    6967/**
    … …  
    506504            JCheckBox deleteNotInList = new JCheckBox(tr("Disable all other plugins"));
    507505
    508             JLabel helpLabel = new JLabel("<html>" + Utils.join("<br/>", Arrays.asList(
     506            JLabel helpLabel = new JLabel("<html>" + String.join("<br/>",
    509507                    tr("Enter a list of plugins you want to download."),
    510508                    tr("You should add one plugin id per line, version information is ignored."),
    511                     tr("You can copy+paste the list of a status report here."))) + "</html>");
     509                    tr("You can copy+paste the list of a status report here.")) + "</html>");
    512510
    513511            if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(GuiHelper.getFrameForComponent(getTabPane()),
    … …  
    559557
    560558        private boolean confirmIgnoreNotFound(List<String> notFound) {
    561             String list = "<ul><li>" + Utils.join("</li><li>", notFound) + "</li></ul>";
     559            String list = "<ul><li>" + String.join("</li><li>", notFound) + "</li></ul>";
    562560            String message = "<html>" + tr("The following plugins were not found. Continue anyway?") + list + "</html>";
    563561            return JOptionPane.showConfirmDialog(GuiHelper.getFrameForComponent(getTabPane()),
  • trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java

    r14095 r15716  
    383383                sb.append('&');
    384384            }
    385             sb.append("changesets=").append(Utils.join(",", changesetIds));
     385            sb.append("changesets=").append(changesetIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
    386386        }
    387387        return sb.toString();
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r13901 r15716  
    9191        try {
    9292            cachedFile = new CachedFile(source);
    93             cachedFile.setParam(Utils.join(",", ImageryInfo.getActiveIds()));
     93            cachedFile.setParam(String.join(",", ImageryInfo.getActiveIds()));
    9494            cachedFile.setFastFail(fastFail);
    9595            try (BufferedReader in = cachedFile
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r15228 r15716  
    352352                + "FORMAT=" + format + ((imageFormatHasTransparency(format) && transparent) ? "&TRANSPARENT=TRUE" : "")
    353353                + "&VERSION=" + this.version + "&" + SERVICE_WMS + "&REQUEST=GetMap&LAYERS="
    354                 + selectedLayers.stream().collect(Collectors.joining(","))
     354                + String.join(",", selectedLayers)
    355355                + "&STYLES="
    356                 + (selectedStyles != null ? Utils.join(",", selectedStyles) : "")
     356                + (selectedStyles != null ? String.join(",", selectedStyles) : "")
    357357                + "&"
    358358                + (belowWMS130() ? "SRS" : "CRS")
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r14384 r15716  
    145145    protected String downloadPluginList(String site, final ProgressMonitor monitor) {
    146146        /* replace %<x> with empty string or x=plugins (separated with comma) */
    147         String pl = Utils.join(",", Config.getPref().getList("plugins"));
     147        String pl = String.join(",", Config.getPref().getList("plugins"));
    148148        String printsite = site.replaceAll("%<(.*)>", "");
    149         if (pl != null && !pl.isEmpty()) {
     149        if (!pl.isEmpty()) {
    150150            site = site.replaceAll("%<(.*)>", "$1"+pl);
    151151        } else {
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r15590 r15716  
    489489                }
    490490                w.append('\n');
     491                w.append("sequence.fallback=");
    491492                String fallback = props.getProperty("sequence.fallback");
    492493                if (fallback != null) {
    493                     w.append("sequence.fallback=" + fallback + ',' + Utils.join(",", allCharSubsets) + '\n');
    494                 } else {
    495                     w.append("sequence.fallback=" + Utils.join(",", allCharSubsets) + '\n');
     494                    w.append(fallback).append(",");
    496495                }
     496                w.append(String.join(",", allCharSubsets)).append("\n");
    497497            }
    498498            Utils.updateSystemProperty("sun.awt.fontconfig", fontconfigFile.toString());
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r15646 r15716  
    904904            throws IOException, ExecutionException, InterruptedException {
    905905        if (Logging.isDebugEnabled()) {
    906             Logging.debug(join(" ", command));
     906            Logging.debug(String.join(" ", command));
    907907        }
    908908        Path out = Files.createTempFile("josm_exec_", ".txt");
    … …  
    11191119            return null;
    11201120        } else {
    1121             return join("\n", limit(Arrays.asList(s.split("\\n")), maxLines, "..."));
     1121            return String.join("\n", limit(Arrays.asList(s.split("\\n")), maxLines, "..."));
    11221122        }
    11231123    }
Note: See TracChangeset for help on using the changeset viewer.