For the "remove(str, i)" example at 18:58, "k" is a typo, correct is: "str", also, ""v" is a typo, correct is: "i". And then for even more understandability, rename "k1" and 'x' above to "k".
@Bruno-fe4tp6 жыл бұрын
thanks
@FenrirTheGray7 жыл бұрын
The Hodor stickers xD
@AlanDarkworld7 жыл бұрын
Will there be a variant of "List.of(...)" that provides a regular, mutable ArrayList? Immutability is nice and dandy, but sometimes you just want a plain old list. Or will I have to stick with Guava's "Lists.newArrayList()"?
@Omega31317 жыл бұрын
Looks like there's no mutable equivalent according to the API.
@drewcaster7 жыл бұрын
Arrays.asList(...) or Stream.of(...) or Arrays.stream(...)
@arnepeeters76633 жыл бұрын
@@drewcaster Arrays.asList returns an immutable List! You need new ArrayList(Arrays.asList(T... args)) if you actually need a regular mutable ArrayList (without streaming) as OP asked.
@ipuluforu7 жыл бұрын
Hi, referring the video at 9:33 I tried the below code. List list = Arrays.asList(1,2,3,4,5,6,7,8,9,10); list.removeIf(n -> n==2); However it resulted in the below error. Exception in thread "main" java.lang.UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:161) at java.util.AbstractList$Itr.remove(AbstractList.java:374) at java.util.Collection.removeIf(Collection.java:415) Can anyone please tell me what I missed actually?
@FrancoisGreen7 жыл бұрын
Here is an answer on Stack Overflow. stackoverflow.com/questions/7885573/remove-on-list-created-by-arrays-aslist-throws-unsupportedoperationexception
@ipuluforu7 жыл бұрын
Cool.... Thanks Francois Green
@ashb0014 жыл бұрын
15:25 Mark makes a small mistake calling it a BiFunction. The foreach actually takes a BiConsumer. That is, consumes two arguments and returns nothing.