제가 초보라고 한다면 "우르르 돌 던지실" 분들 많은 것으로 알고 있습니다. 초보소리는 못 듣는 저이지만 ibm dw에서 재밌는 메일이 와서 찾아가보니 익숙한 분이 재밌는 문제를 내셨더군요.
데이터 목록에서 양쪽 다 있는 원소 목록 either는 구했습니다. 두 목록을 포괄하는 both를 구해보실 분. 문제

간단하지만 테스트케이스를 만들어서 시도했습니다. ㅡㅡ; 이 말에 벌써 긴장하시는 분들도 계시는 것 같군요. 릴렉스, 테킷이지.
import java.util.ArrayList;
import junit.framework.TestCase;
public class FirstQuizSetTest extends TestCase {
 private FirstQuizSet quizSet;
 private ArrayList ys;
 private ArrayList xs;
 
 protected void setUp() throws Exception {
  quizSet = new FirstQuizSet();
  ys = new ArrayList();
  xs = new ArrayList();
  super.setUp();
 }
 public void testBoth() {
  xs.add("1");
  ys.add("2");
  ArrayList both = quizSet.both(xs, ys);
  assertTrue(both.contains("1"));
  assertTrue(both.contains("2"));
 }
 public void testOrder() {
  xs.add("1");
  ys.add("2");
  ArrayList both = quizSet.both(xs, ys);
  String string = both.toString();
  assertEquals("[1, 2]", string);
 }
}

정답은 구했습니다. 한 번 가서 풀어보세요.
제 소스는 첨부합니다.

+ Recent posts