@SafeVarargs
    @SuppressWarnings("unchecked")
    public ElementCountSet(FinalPair<AbstractElement, Integer>... p) {
        if (p == null)
            throw new NullPointerException("Element is null.");
        FinalPair<AbstractElement, Integer>[] ae = new FinalPair[p.length];
        HashSet<AbstractElement> temp = new HashSet<>(p.length, 1f);
        if (p.length != 0)
            for (int i = 0; i != p.length; ++i)
                if (p[i] == null) {
                    throw new NullPointerException("Element is null.");
                } else {
                    if (!temp.add(p[i].first))
                        throw new AlreadyExistsInContainerException("The element"
                                + " has already existed in the array.");
                    ae[i] = p[i];
                }
        elements = new SimpleArrayList<>(ae);
    }