Component (final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); @SuppressWarnings("unchecked") final C choices = (C)value; if (choices != null) { setText(choices.formatDescription(occurrencesMap.get(choices).size())); } return rendererComponent; }