Ignore:
Timestamp:
2014-04-26T17:39:23+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - use diamond operator where applicable

File:
1 edited

Legend:

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

    r6987 r7005  
    7272     * Remember movements, so the user can later undo it for certain nodes
    7373     */
    74     private static final Map<Node, EastNorth> rememberMovements = new HashMap<Node, EastNorth>();
     74    private static final Map<Node, EastNorth> rememberMovements = new HashMap<>();
    7575
    7676    /**
     
    9898            if (!isEnabled())
    9999                return;
    100             final Collection<Command> commands = new LinkedList<Command>();
     100            final Collection<Command> commands = new LinkedList<>();
    101101            final Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected();
    102102            try {
     
    145145        }
    146146
    147         final List<Node> nodeList = new ArrayList<Node>();
    148         final List<WayData> wayDataList = new ArrayList<WayData>();
     147        final List<Node> nodeList = new ArrayList<>();
     148        final List<WayData> wayDataList = new ArrayList<>();
    149149        final Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected();
    150150
     
    165165                if (nodeList.size() == 2 || nodeList.isEmpty()) {
    166166                    OrthogonalizeAction.rememberMovements.clear();
    167                     final Collection<Command> commands = new LinkedList<Command>();
     167                    final Collection<Command> commands = new LinkedList<>();
    168168
    169169                    if (nodeList.size() == 2) {  // fixed direction
     
    202202     */
    203203    private static List<List<WayData>> buildGroups(List<WayData> wayDataList) {
    204         List<List<WayData>> groups = new ArrayList<List<WayData>>();
    205         Set<WayData> remaining = new HashSet<WayData>(wayDataList);
     204        List<List<WayData>> groups = new ArrayList<>();
     205        Set<WayData> remaining = new HashSet<>(wayDataList);
    206206        while (!remaining.isEmpty()) {
    207             List<WayData> group = new ArrayList<WayData>();
     207            List<WayData> group = new ArrayList<>();
    208208            groups.add(group);
    209209            Iterator<WayData> it = remaining.iterator();
    210210            WayData next = it.next();
    211211            it.remove();
    212             extendGroupRec(group, next, new ArrayList<WayData>(remaining));
     212            extendGroupRec(group, next, new ArrayList<>(remaining));
    213213            remaining.removeAll(group);
    214214        }
     
    283283
    284284        // put the nodes of all ways in a set
    285         final HashSet<Node> allNodes = new HashSet<Node>();
     285        final HashSet<Node> allNodes = new HashSet<>();
    286286        for (WayData w : wayDataList) {
    287287            for (Node n : w.way.getNodes()) {
     
    291291
    292292        // the new x and y value for each node
    293         final HashMap<Node, Double> nX = new HashMap<Node, Double>();
    294         final HashMap<Node, Double> nY = new HashMap<Node, Double>();
     293        final HashMap<Node, Double> nX = new HashMap<>();
     294        final HashMap<Node, Double> nY = new HashMap<>();
    295295
    296296        // calculate the centroid of all nodes
     
    314314        final Direction[][] ORIENTATIONS = {HORIZONTAL, VERTICAL};
    315315        for (Direction[] orientation : ORIENTATIONS){
    316             final HashSet<Node> s = new HashSet<Node>(allNodes);
     316            final HashSet<Node> s = new HashSet<>(allNodes);
    317317            int s_size = s.size();
    318318            for (int dummy = 0; dummy < s_size; ++dummy) {
     
    322322                final Node dummy_n = s.iterator().next();     // pick arbitrary element of s
    323323
    324                 final HashSet<Node> cs = new HashSet<Node>(); // will contain each node that can be reached from dummy_n
     324                final HashSet<Node> cs = new HashSet<>(); // will contain each node that can be reached from dummy_n
    325325                cs.add(dummy_n);                              // walking only on horizontal / vertical segments
    326326
     
    381381
    382382        // rotate back and log the change
    383         final Collection<Command> commands = new LinkedList<Command>();
     383        final Collection<Command> commands = new LinkedList<>();
    384384        for (Node n: allNodes) {
    385385            EastNorth tmp = new EastNorth(nX.get(n), nY.get(n));
Note: See TracChangeset for help on using the changeset viewer.