Wednesday, 14 August 2013

Adding to front of List throws?

Adding to front of List throws?

Trying to use the following to add to the front of a List but throws on
the add. The doc says it's supposed to shift. What is the fix or
workaround?
List<String> whatever = Arrays.asList("Blah1", "Blah2");
whatever.add(0, "BlahAll"); // <- Throws

No comments:

Post a Comment