Ignore:
Timestamp:
2016-07-21T14:25:51+02:00 (8 years ago)
Author:
simon04
Message:

JOSM/wikipedia: switch to Java 8

Location:
applications/editors/josm/plugins/wikipedia/src/org/wikipedia
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikidataTagCellRenderer.java

    r32610 r32691  
    1313import java.util.concurrent.ExecutionException;
    1414import java.util.concurrent.Future;
     15import java.util.stream.Collectors;
    1516
    1617import javax.swing.JLabel;
     
    1920
    2021import org.openstreetmap.josm.Main;
    21 import org.openstreetmap.josm.tools.Predicates;
    2222import org.openstreetmap.josm.tools.Utils;
    2323
     
    6161        } else if (id.contains(";")) {
    6262            final List<String> ids = Arrays.asList(id.split("\\s*;\\s*"));
    63             if (Utils.forAll(ids, Predicates.stringMatchesPattern(WikipediaApp.WIKIDATA_PATTERN))) {
     63            if (ids.stream().allMatch(i -> WikipediaApp.WIKIDATA_PATTERN.matcher(i).matches())) {
    6464                return renderValues(ids, table, component);
    6565            }
     
    9494            texts.add(WikipediaApp.WikidataEntry.getLabelText(id, label));
    9595        }
    96         component.setText("<html>" + Utils.join("; ", texts));
     96        component.setText("<html>" + texts.stream().collect(Collectors.joining("; ")));
    9797        component.setToolTipText("<html>" + Utils.joinAsHtmlUnorderedList(texts));
    9898        return component;
  • applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaApp.java

    r32687 r32691  
    177177
    178178            try {
    179                 final String requestBody = "articles=" + Utils.encodeUrl(Utils.join(",", articleNames));
     179                final String requestBody = "articles=" + Utils.encodeUrl(articleNames.stream().collect(Collectors.joining(",")));
    180180                try (final Scanner scanner = new Scanner(
    181181                        HttpClient.create(new URL(url), "POST").setReasonForRequest("Wikipedia")
  • applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaCopyTemplate.java

    r32424 r32691  
    100100        protected Node getSelectedNode() {
    101101            DataSet ds = getLayerManager().getEditDataSet();
    102             if (ds == null || ds.getSelected() == null) {
     102            if (ds == null) {
    103103                return null;
    104104            } else {
    105                 Collection<Node> nodes = Utils.filteredCollection(ds.getSelected(), Node.class);
    106                 return nodes.isEmpty() ? null : nodes.iterator().next();
     105                return (Node) ds.getSelected().stream().filter(Node.class::isInstance).findFirst().orElse(null);
    107106            }
    108107        }
Note: See TracChangeset for help on using the changeset viewer.