// List A 에 포함된 요소 B 에서 제거
String[] name1 = {"ABC", "CBB", "KKK"};
String[] name2 = {"ABC", "CBB"};

List listA = Arrays.asList(name1);
List listB = new ArrayList<>(Arrays.asList(name2));

//listA.remove("ABC");  // 이 경우 에러 발생 - java.lang.UnsupportedOperationException
listB.remove("ABC");

// for (String s : listB) {
// listA.remove(s);
// }
System.out.println(">" + listA);
System.out.println(">" + listB);

 

--------------------------------------------------

 

>[ABC, CBB, KKK]
>[CBB]

'프로그래밍언어' 카테고리의 다른 글

K번째수  (0) 2019.08.30
체육복  (0) 2019.08.30
모의고사  (0) 2019.08.30
HashMap 처리  (0) 2019.07.29
완주하지 못한 선수  (0) 2019.07.29

+ Recent posts