aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2014-10-31 07:07:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-31 07:07:07 +0000
commited575b62da197e81ace23eeb1af09fd776fa0b41 (patch)
tree604dcb68eb6db08bc0d1542d19768373642b1cc7 /java
parent61d43e5c941e7a76d614ffbe756137c02a34cdc1 (diff)
parentd443146c343fd880eb6178bae94edec0865bce62 (diff)
downloadlatinime-ed575b62da197e81ace23eeb1af09fd776fa0b41.tar.gz
latinime-ed575b62da197e81ace23eeb1af09fd776fa0b41.tar.xz
latinime-ed575b62da197e81ace23eeb1af09fd776fa0b41.zip
Merge "Add documentation for CollectionUtils#arrayAsList"
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/utils/CollectionUtils.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java b/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
index f9839eb91..01f5e1079 100644
--- a/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
@@ -22,16 +22,27 @@ import java.util.Collection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+/**
+ * Utility methods for working with collections.
+ */
public final class CollectionUtils {
private CollectionUtils() {
// This utility class is not publicly instantiable.
}
+ /**
+ * Converts a sub-range of the given array to an ArrayList of the appropriate type.
+ * @param array Array to be converted.
+ * @param start First index inclusive to be converted.
+ * @param end Last index exclusive to be converted.
+ * @throws IllegalArgumentException if start or end are out of range or start &gt; end.
+ */
@Nonnull
public static <E> ArrayList<E> arrayAsList(@Nonnull final E[] array, final int start,
final int end) {
if (start < 0 || start > end || end > array.length) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid start: " + start + " end: " + end
+ + " with array.length: " + array.length);
}
final ArrayList<E> list = new ArrayList<>(end - start);