src/main/java/eu/digitisation/math/Counter.java
public List<Type> keyList(Order order) {
        List<Type> list = new ArrayList<Type>(keySet());
        if (order == Order.ASCENDING) {
            Collections.sort(list);
        } else if (order == Order.DESCENDING) {
            Collections.sort(list, Collections.reverseOrder());
        } else if (order == Order.ASCENDING_VALUE) {
            Collections.sort(list, new KeyComparator());
        } else if (order == Order.DESCENDING_VALUE) {
            Collections.sort(list, Collections.reverseOrder(new KeyComparator()));
        } else if (order == Order.LEXICOGRAPHIC
                && list.size() > 0
                && list.get(0).getClass().equals(String.class)) {
            Collator collator = Collator.getInstance();
            collator.setStrength(Collator.TERTIARY);
            collator.setDecomposition(Collator.FULL_DECOMPOSITION);
            Collections.sort(list, collator);
        }
        return list;
    }
/**
     *
     * @param order determines ascending or descending order
     * @return the sorted list of keys stored in the counter
     */
@param order determines ascending or descending order
@return the sorted list of keys stored in the counter
@param order determines ascending or descending order @return the sorted list of keys stored in the counter
public List<Type> keyList(Order order) {
        List<Type> list = new ArrayList<Type>(keySet());
        if (order == Order.ASCENDING) {
            Collections.sort(list);
        } else if (order == Order.DESCENDING) {
            Collections.sort(list, Collections.reverseOrder());
        } else if (order == Order.ASCENDING_VALUE) {
            Collections.sort(list, new KeyComparator());
        } else if (order == Order.DESCENDING_VALUE) {
            Collections.sort(list, Collections.reverseOrder(new KeyComparator()));
        } else if (order == Order.LEXICOGRAPHIC
                && list.size() > 0
                && list.get(0).getClass().equals(String.class)) {
            Collator collator = Collator.getInstance();
            collator.setStrength(Collator.TERTIARY);
            collator.setDecomposition(Collator.FULL_DECOMPOSITION);
            Collections.sort(list, collator);
        }
        return list;
    }
public List < Type > keyList ( Order order ) { List < Type > list = new ArrayList < Type > ( keySet ( ) ) ; if ( order == Order . ASCENDING ) { Collections . sort ( list ) ; } else if ( order == Order . DESCENDING ) { Collections . sort ( list , Collections . reverseOrder ( ) ) ; } else if ( order == Order . ASCENDING_VALUE ) { Collections . sort ( list , new KeyComparator ( ) ) ; } else if ( order == Order . DESCENDING_VALUE ) { Collections . sort ( list , Collections . reverseOrder ( new KeyComparator ( ) ) ) ; } else if ( order == Order . LEXICOGRAPHIC && list . size ( ) > 0 && list . get ( 0 ) . getClass ( ) . equals ( String . class ) ) { Collator collator = Collator . getInstance ( ) ; collator . setStrength ( Collator . TERTIARY ) ; collator . setDecomposition ( Collator . FULL_DECOMPOSITION ) ; Collections . sort ( list , collator ) ; } return list ; }
@param order determines ascending or descending order
 @return the sorted list of keys stored in the counter
@param order determines ascending or descending order @return the sorted list of keys stored in the counter