class ItemComparator implements Comparator, Serializable {

    @Override
    public int compare(Object first, Object second)
    {
        if ((!(first instanceof Item)) || (!(second instanceof Item)))
        {
            throw new IllegalArgumentException("Arguments must be Items");
        }

        // Retrieve a chosen value from the array for comparison
        String firstValue = getValue((Item) first);
        String secondValue = getValue((Item) second);

        if (firstValue == null && secondValue == null)
        {
            return 0;
        }

        if (firstValue == null)
        {
            return -1;
        }

        if (secondValue == null)
        {
            return 1;
        }

        // See the javadoc for java.lang.String for an explanation
        // of the return value.
        return firstValue.compareTo(secondValue);
    }

    public  ItemComparator(String element, String qualifier, String language,
            boolean max);

}