Index: trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 18469)
+++ trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 18470)
@@ -157,5 +157,6 @@
      */
     public List<Pair<Node, Node>> getNodePairs(boolean sort) {
-        List<Pair<Node, Node>> chunkSet = new ArrayList<>();
+        // For a way of size n, there are n - 1 pairs (a -> b, b -> c, c -> d, etc., 4 nodes -> 3 pairs)
+        List<Pair<Node, Node>> chunkSet = new ArrayList<>(this.getNodesCount() - 1);
         if (isIncomplete()) return chunkSet;
         Node lastN = null;
