Devin McIntyre
Jul 24, 2017 · 1 min read

“Arrays.asList : Be aware that the lists created by this method are non-modifiable”

This isn’t entirely true. While you can’t use add/remove/etc, you CAN modify the elements for any given index of the resulting list, including what the index holds. Arrays.asList(1, 2,3).set(0, 4).forEach(System.out::println) will result in “4 2 3” rather than “1 2 3”.

    Devin McIntyre

    Written by