diff options
Diffstat (limited to 'guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java')
-rw-r--r-- | guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java index 8f9315d..0cee6c4 100644 --- a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java @@ -35,10 +35,6 @@ import java.util.RandomAccess; * Static utility methods pertaining to {@code int} primitives, that are not * already found in either {@link Integer} or {@link Arrays}. * - * <p>See the Guava User Guide article on <a href= - * "http://code.google.com/p/guava-libraries/wiki/PrimitivesExplained"> - * primitive utilities</a>. - * * @author Kevin Bourrillion * @since 1.0 */ @@ -364,21 +360,20 @@ public final class Ints { } /** - * Returns an array containing each value of {@code collection}, converted to - * a {@code int} value in the manner of {@link Number#intValue}. + * Copies a collection of {@code Integer} instances into a new array of + * primitive {@code int} values. * * <p>Elements are copied from the argument collection as if by {@code * collection.toArray()}. Calling this method is as thread-safe as calling * that method. * - * @param collection a collection of {@code Number} instances + * @param collection a collection of {@code Integer} objects * @return an array containing the same values as {@code collection}, in the * same order, converted to primitives * @throws NullPointerException if {@code collection} or any of its elements * is null - * @since 1.0 (parameter was {@code Collection<Integer>} before 12.0) */ - public static int[] toArray(Collection<? extends Number> collection) { + public static int[] toArray(Collection<Integer> collection) { if (collection instanceof IntArrayAsList) { return ((IntArrayAsList) collection).toIntArray(); } @@ -388,7 +383,7 @@ public final class Ints { int[] array = new int[len]; for (int i = 0; i < len; i++) { // checkNotNull for GWT (do not optimize) - array[i] = ((Number) checkNotNull(boxedArray[i])).intValue(); + array[i] = (Integer) checkNotNull(boxedArray[i]); } return array; } @@ -475,8 +470,7 @@ public final class Ints { @Override public Integer set(int index, Integer element) { checkElementIndex(index, size()); int oldValue = array[start + index]; - // checkNotNull for GWT (do not optimize) - array[start + index] = checkNotNull(element); + array[start + index] = checkNotNull(element); // checkNotNull for GWT (do not optimize) return oldValue; } @@ -527,7 +521,7 @@ public final class Ints { } int[] toIntArray() { - // Arrays.copyOfRange() is not available under GWT + // Arrays.copyOfRange() requires Java 6 int size = size(); int[] result = new int[size]; System.arraycopy(array, start, result, 0, size); |