Ignore:
Timestamp:
2013-09-07T17:52:27+02:00 (13 years ago)
Author:
Don-vip
Message:

Make some defensive copies of user-supplied arrays, move QuadStateCheckBox to widgets package, javadoc

File:
1 edited

Legend:

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

    r6175 r6221  
    3030import java.util.AbstractList;
    3131import java.util.ArrayList;
     32import java.util.Arrays;
    3233import java.util.Collection;
    3334import java.util.Iterator;
     
    241242    }
    242243
     244    /**
     245     * Copies the given array. Unlike {@link Arrays#copyOf}, this method is null-safe.
     246     * @param array The array to copy
     247     * @return A copy of the original array, or {@code null} if {@code array} is null
     248     * @since 6221
     249     */
     250    public static <T> T[] copyArray(T[] array) {
     251        if (array != null) {
     252            return Arrays.copyOf(array, array.length);
     253        }
     254        return null;
     255    }
     256   
    243257    /**
    244258     * Simple file copy function that will overwrite the target file.<br/>
Note: See TracChangeset for help on using the changeset viewer.