How is List.of() working? - Cracking the Java Coding Interview

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

List of one primitive array was the root of many frustrated hours.

larryd
Автор

Sir I am a complete beginner in java..
Recently I learnd basics and some Oops concepts how can I learn these advanced concepts which are used to develop projects by using java.can you suggest me any root map to learn the core concepts.

pranayvonteru
Автор

I was under the impression that for fewer than 10 elements, it didn't use an array or vararg.

CrapE_DM
Автор

It would be awesome if java actually would enforce nullable and nonnull.
Because at the moment you can just simply violate these rules and the compiler doesn't care.

Not even a simple warning...

Speiger
Автор

int[] newArrayString = {1, 2, 3, 4, 5};
List<int[]> listArray = List.of(newArrayString);
newArrayString[2]= 4;
for(int[] x : listArray){
System.out.println(x[2]);
} This prints 4 as output. that means listArray is not a defensive copy. Is that right?

dilendrasajini
Автор

I have added null value and working
List<String> arryStr = new ArrayList<String>();
arryStr.add("2");
arryStr.add("12");
arryStr.add("22");
arryStr.add(null);
arryStr.add("23");

List uar1 = List.of(arryStr);
System.out.println("uar us "+uar1);
for(Object l : uar1)
System.out.println("uar for loop 2 us "+l);

saichaithvik
join shbcf.ru