コード例 #1
0
  /** Test of intersect method, of class Set. */
  @Test
  public void testIntersect() {
    Set<Integer> otherSet = new Set<>();
    otherSet.addElement(1349);
    otherSet.addElement(138);
    otherSet.addElement(1349);
    otherSet.addElement(16);

    String res = "";
    Set<Integer> resultSet = set.intersect(otherSet);
    for (Integer i : resultSet.toUniqueList()) {
      res += i + " ";
    }
    assertEquals("16 138 ", res);
  }
コード例 #2
0
  /** Test of union method, of class Set. */
  @Test
  public void testUnion() {
    Set<Integer> otherSet = new Set<>();
    otherSet.addElement(1349);
    otherSet.addElement(138);
    otherSet.addElement(1349);
    otherSet.addElement(12);

    Set<Integer> result = set.union(otherSet);
    String res = "";
    for (Integer i : result.toUniqueList()) {
      System.out.format("%d ", i);
    }

    System.out.println(res);
  }