/** * Transform values in the collection from Strings to Objects, using {@link * com.atlassian.jira.issue.search.LuceneFieldSorter#getValueFromLuceneField(String)} * * @param values A Collection of Strings, obtained from the Lucene Index * @param mapper A statsMapper used to convert to objects * @return a collection of transformed objects, never null */ private static Collection transformAndRemoveInvaid(Collection values, StatisticsMapper mapper) { Collection output = new ArrayList(); for (final Object value1 : values) { String key = (String) value1; final Object value; if (key != null) { value = mapper.getValueFromLuceneField(key); } else { value = null; } // only valid values should be added to the map if (mapper.isValidValue(value)) { output.add(value); } } return output; }