public int numSimilarGroups(String[] a) {
        if (a == null || a.length == 0)
            return 0;
        int count = a.length;
        Union un = new Union(count);
        for (int i = 0; i < a.length; i++) {
            for (int j = i + 1; j < a.length; j++) {
                if (compare(a[i], a[j]) && un.connect(i, j))
                    count--;
            }
        }
        return count;
    }
Why Did you create this class? what does it do?
src/problems/hard/SimilarStringGroups.java