Ignore:
Timestamp:
2014-01-17T21:33:44+01:00 (10 years ago)
Author:
Don-vip
Message:

where applicable, replace System.arraycopy by Arrays.copyOf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r6661 r6717  
    952952        return result;
    953953    }
     954   
     955    /**
     956     * Adds the given item at the end of a new copy of given array.
     957     * @param array The source array
     958     * @param item The item to add
     959     * @return An extended copy of {@code array} containing {@code item} as additional last element
     960     * @since 6717
     961     */
     962    public static <T> T[] addInArrayCopy(T[] array, T item) {
     963        T[] biggerCopy = Arrays.copyOf(array, array.length + 1);
     964        biggerCopy[array.length] = item;
     965        return biggerCopy;
     966    }
    954967}
Note: See TracChangeset for help on using the changeset viewer.