Ignore:
Timestamp:
2023-07-24T15:55:23+02:00 (2 years ago)
Author:
taylor.smock
Message:

reltoolbox: Clean up a bunch of lint warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java

    r35829 r36102  
    1010import java.util.Collections;
    1111import java.util.HashSet;
    12 import java.util.Iterator;
    1312import java.util.List;
    1413import java.util.Map;
     
    4443 */
    4544public class ReconstructPolygonAction extends JosmAction implements ChosenRelationListener {
    46     private ChosenRelation rel;
    47 
    48     private static final List<String> IRRELEVANT_KEYS = Arrays.asList(new String[] {
    49             "source", "created_by", "note"});
     45    private final ChosenRelation rel;
     46
     47    private static final List<String> IRRELEVANT_KEYS = Arrays.asList("source", "created_by", "note");
    5048
    5149    public ReconstructPolygonAction(ChosenRelation rel) {
     
    109107                // this ring has inner rings, so we leave a multipolygon in
    110108                // place and don't reconstruct the rings.
    111                 Relation n = null;
     109                Relation n;
    112110                if (relationReused) {
    113111                    n = new Relation();
     
    153151                }
    154152                List<OsmPrimitive> referrers = w.getReferrers();
    155                 for (Iterator<OsmPrimitive> ref1 = relations.iterator(); ref1.hasNext();) {
    156                     if (!referrers.contains(ref1.next())) {
    157                         ref1.remove();
    158                     }
    159                 }
     153                relations.removeIf(osmPrimitive -> !referrers.contains(osmPrimitive));
    160154            }
    161155            tags.putAll(r.getKeys());
     
    169163                    Set<String> keys = new HashSet<>(w.keySet());
    170164                    keys.removeAll(tags.keySet());
    171                     keys.removeAll(IRRELEVANT_KEYS);
     165                    IRRELEVANT_KEYS.forEach(keys::remove);
    172166                    if (keys.isEmpty()) {
    173167                        if (candidateWay == null) {
     
    211205
    212206    private boolean isSuitableRelation(Relation newRelation) {
    213         if (newRelation == null || !"multipolygon".equals(newRelation.get("type")) || newRelation.getMembersCount() == 0)
    214             return false;
    215         else
    216             return true;
     207        return newRelation != null && "multipolygon".equals(newRelation.get("type")) && newRelation.getMembersCount() != 0;
    217208    }
    218209}
Note: See TracChangeset for help on using the changeset viewer.