private static int listSize(ArrayList<?> list) {
    if (list == null) {
      return 0;
    }

    return list.size();
  }
Gets the list size of the given list, or {@code 0} if given {@code null}.

@param list {@code null-ok;} the list in question
@return {@code >= 0;} its size
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/file/AnnotationsDirectoryItem.java