diff options
author | 2014-10-31 07:09:52 +0000 | |
---|---|---|
committer | 2014-10-31 07:09:52 +0000 | |
commit | ae9bfdc061d98913ab15c4a74788a0e15deccdb1 (patch) | |
tree | ca3b4f4d9d581dba80d1640802355dab1b9bc0e8 /java/src | |
parent | dca729bd21b3f1223df179e3b16fc9c1bba1acd4 (diff) | |
parent | ed575b62da197e81ace23eeb1af09fd776fa0b41 (diff) | |
download | latinime-ae9bfdc061d98913ab15c4a74788a0e15deccdb1.tar.gz latinime-ae9bfdc061d98913ab15c4a74788a0e15deccdb1.tar.xz latinime-ae9bfdc061d98913ab15c4a74788a0e15deccdb1.zip |
am ed575b62: Merge "Add documentation for CollectionUtils#arrayAsList"
* commit 'ed575b62da197e81ace23eeb1af09fd776fa0b41':
Add documentation for CollectionUtils#arrayAsList
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/utils/CollectionUtils.java | 13 |
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 > 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); |