Returns a fixed-size list backed by the specified array, similar to Arrays#asList(Object[]). The list supports List#set(int, Object), but any attempt to set a value to null will result in a NullPointerException. The returned list maintains the values, but not the
(int... backingArray)
| 518 | |
| 519 | |
| 520 | public static List<Integer> asList(int... backingArray) { |
| 521 | if (backingArray.length == 0) { |
| 522 | return Collections.emptyList(); |
| 523 | } |
| 524 | return new IntArrayAsList(backingArray); |
| 525 | } |
| 526 | |
| 527 | @GwtCompatible |
| 528 | private static class IntArrayAsList extends AbstractList<Integer> implements RandomAccess, Serializable { |
no outgoing calls