aboutsummaryrefslogtreecommitdiffstats
path: root/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java')
-rw-r--r--guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java20
1 files changed, 7 insertions, 13 deletions
diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java
index 92899c7..d1cee13 100644
--- a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java
+++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java
@@ -35,10 +35,6 @@ import java.util.RandomAccess;
* Static utility methods pertaining to {@code short} primitives, that are not
* already found in either {@link Short} 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
*/
@@ -366,21 +362,20 @@ public final class Shorts {
}
/**
- * Returns an array containing each value of {@code collection}, converted to
- * a {@code short} value in the manner of {@link Number#shortValue}.
+ * Copies a collection of {@code Short} instances into a new array of
+ * primitive {@code short} 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 Short} 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<Short>} before 12.0)
*/
- public static short[] toArray(Collection<? extends Number> collection) {
+ public static short[] toArray(Collection<Short> collection) {
if (collection instanceof ShortArrayAsList) {
return ((ShortArrayAsList) collection).toShortArray();
}
@@ -390,7 +385,7 @@ public final class Shorts {
short[] array = new short[len];
for (int i = 0; i < len; i++) {
// checkNotNull for GWT (do not optimize)
- array[i] = ((Number) checkNotNull(boxedArray[i])).shortValue();
+ array[i] = (Short) checkNotNull(boxedArray[i]);
}
return array;
}
@@ -477,8 +472,7 @@ public final class Shorts {
@Override public Short set(int index, Short element) {
checkElementIndex(index, size());
short 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;
}
@@ -529,7 +523,7 @@ public final class Shorts {
}
short[] toShortArray() {
- // Arrays.copyOfRange() is not available under GWT
+ // Arrays.copyOfRange() requires Java 6
int size = size();
short[] result = new short[size];
System.arraycopy(array, start, result, 0, size);