class ListHeaderProducer {

    public List<T> createQualitySortedList(String header) {
        final List<T> tokens = new ArrayList<>();
        int n;
        int p = 0;
        final int length = header.length();
        while (p < length) {
            n = scan(header, p, ',');

            String token;
            if (charAtIs(header, n, ',')) {
                token = header.substring(p, n);
            } else {
                token = header.substring(p);
                n = length;
            }

            tokens.add(itemFactory.createItem(token));

            p = n + 1;
        }

        if (tokens.size() > 1) {
            Collections.sort(tokens, QUALITY_VALUE_COMPARATOR);
        }

        return tokens;
    }

    public  ListHeaderProducer(ListItemFactory<T> itemFactory);

}