Changeset 7436 in josm
- Timestamp:
- 2014-08-20T14:36:08+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/SequenceCommand.java
r7005 r7436 12 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 13 import org.openstreetmap.josm.tools.ImageProvider; 14 import org.openstreetmap.josm.tools.Utils; 14 15 15 16 /** … … 69 70 return sequence[sequence.length-1]; 70 71 } 71 72 72 73 protected final void undoCommands(int start) { 73 74 // We probably aborted this halfway though the … … 114 115 return prims; 115 116 } 116 117 117 118 protected final void setSequence(Command[] sequence) { 118 this.sequence = Arrays.copyOf(sequence, sequence.length);119 this.sequence = Utils.copyArray(sequence); 119 120 } 120 121 121 122 protected final void setSequenceComplete(boolean sequenceComplete) { 122 123 this.sequenceComplete = sequenceComplete; -
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r7005 r7436 3 3 4 4 import java.util.AbstractSet; 5 import java.util.Arrays;6 5 import java.util.Collection; 7 6 import java.util.ConcurrentModificationException; … … 10 9 import java.util.NoSuchElementException; 11 10 import java.util.Set; 11 12 import org.openstreetmap.josm.tools.Utils; 12 13 13 14 /** … … 148 149 private void copyArray() { 149 150 if (arrayCopyNecessary) { 150 data = Arrays.copyOf(data, data.length);151 data = Utils.copyArray(data); 151 152 arrayCopyNecessary = false; 152 153 } -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r7335 r7436 270 270 */ 271 271 public static Class<Test>[] getAllAvailableTests() { 272 return Arrays.copyOf(allAvailableTests, allAvailableTests.length);272 return Utils.copyArray(allAvailableTests); 273 273 } 274 274 -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r7276 r7436 342 342 if (!canMoveStyles(sel, delta)) 343 343 return; 344 int[] selSorted = Arrays.copyOf(sel, sel.length);344 int[] selSorted = Utils.copyArray(sel); 345 345 Arrays.sort(selSorted); 346 346 List<StyleSource> data = new ArrayList<>(styles.getStyleSources()); … … 361 361 if (sel.length == 0) 362 362 return false; 363 int[] selSorted = Arrays.copyOf(sel, sel.length);363 int[] selSorted = Utils.copyArray(sel); 364 364 Arrays.sort(selSorted); 365 365 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/PuwgProjectionChoice.java
r7025 r7436 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util.Arrays;7 6 import java.util.Collection; 8 7 import java.util.Collections; 8 9 import org.openstreetmap.josm.tools.Utils; 9 10 10 11 public class PuwgProjectionChoice extends ListProjectionChoice { … … 46 47 @Override 47 48 public String[] allCodes() { 48 return Arrays.copyOf(CODES, CODES.length);49 return Utils.copyArray(CODES); 49 50 } 50 51 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r7423 r7436 311 311 312 312 /** 313 * Copies the given array. Unlike {@link Arrays#copyOf}, this method is null-safe. 314 * @param array The array to copy 315 * @return A copy of the original array, or {@code null} if {@code array} is null 316 * @since 7436 317 */ 318 public static int[] copyArray(int[] array) { 319 if (array != null) { 320 return Arrays.copyOf(array, array.length); 321 } 322 return null; 323 } 324 325 /** 313 326 * Simple file copy function that will overwrite the target file.<br> 314 327 * @param in The source file
Note:
See TracChangeset
for help on using the changeset viewer.