목록의 사본 및 목록합니다내가 테이블에서 검색된 데이터를 비교해야
이 // first click
// get list of data
originalList = getValue(columnX);
// copy
List<String> copy1 = new ArrayList<String>(originalList);
//sort
Collections.sort(copy1);
System.out.println("copy" + copy1);
// verify
assertEquals(copy1, originalList); //this is OK
//second click is done here
// copy
List<String> copy2 = new ArrayList<String>(originalList);
// sort
Collections.sort(copy2);
System.out.println("copy2" + copy2);=>copy2 give same values as copy1!!!it should not
// assertEquals (COPY2, originalList를) 확인을; => wrong
ArrayList.clone? – mellamokb
? 무슨 뜻이에요? 내가 만든 copy2는 나에게 copy와 같은 값을 주었고, 두 번째로 클릭했을 때 다른 값이어야한다. – lola
copy와 copy2의 생성 사이에 originalList는 바뀌지 않는다. 그래서 왜 * shouldnt * sorting copy copy2는 같은 결과를 산출합니까? – claymore1977