From 7a3de4dca9e03a59bad21e50c3a751e839baab14 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 27 Oct 2014 18:20:44 +0900 Subject: Add null analysis annotation to CollectionUtils Change-Id: I3a610b037d6d1431cced3ea193171108bd5a040d --- .../com/android/inputmethod/latin/utils/CollectionUtils.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/utils/CollectionUtils.java') diff --git a/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java b/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java index d0df72479..f9839eb91 100644 --- a/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java @@ -19,15 +19,17 @@ package com.android.inputmethod.latin.utils; import java.util.ArrayList; import java.util.Collection; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public final class CollectionUtils { private CollectionUtils() { // This utility class is not publicly instantiable. } - public static ArrayList arrayAsList(final E[] array, final int start, final int end) { - if (array == null) { - throw new NullPointerException(); - } + @Nonnull + public static ArrayList arrayAsList(@Nonnull final E[] array, final int start, + final int end) { if (start < 0 || start > end || end > array.length) { throw new IllegalArgumentException(); } @@ -44,7 +46,7 @@ public final class CollectionUtils { * @param c Collection to test. * @return Whether c contains no elements. */ - public static boolean isNullOrEmpty(final Collection c) { + public static boolean isNullOrEmpty(@Nullable final Collection c) { return c == null || c.isEmpty(); } } -- cgit v1.2.3-83-g751a