Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Compliant Solution (Index Getter)

This noncompliant code example compliant solution makes the array private, and provides a public methods to get individual items and array size

Code Block
bgColor#ffcccc#ccccff
private static final String[] items = {/* ... */};

public static final String getItem(int index) {
  return items[index];
}

public static final int getItemCount() {
  return items.length;
}

...