@Override
    public double d(T[] a, T[] b) {
        Set<T> union = new HashSet<>(Arrays.asList(b));
        Collections.addAll(union, a);

        Set<T> intersection = new HashSet<>();
        Collections.addAll(intersection, a);
        intersection.retainAll(union);

        return 1.0 - (double) intersection.size() / union.size();
    }
@Test
    public void testDistance() {
        System.out.println("distance");
        Set<Integer> a = new HashSet<>();
        a.add(1);
        a.add(2);
        a.add(3);
        a.add(4);

        Set<Integer> b = new HashSet<>();
        b.add(3);
        b.add(4);
        b.add(5);
        b.add(6);

        assertEquals(0.6666667, JaccardDistance.d(a, b), 1E-7);
    }