### Question:
CaseInsensitiveFacet extends GenericFacet { public static void deduplicateCaseInsensitiveValues(FacetFieldObject facetFieldObject) { Map<String, GenericFacet> rollupMap = new LinkedHashMap<>(facetFieldObject.getValues().size()); for (GenericFacet genericFacet: facetFieldObject.getValues()) { CaseInsensitiveFacet deptFacet = (CaseInsensitiveFacet) genericFacet; GenericFacet existingFacet = rollupMap.get(deptFacet.getSearchValue()); if (existingFacet == null) { rollupMap.put(deptFacet.getSearchValue(), deptFacet); } else { existingFacet.setCount(existingFacet.getCount() + deptFacet.getCount()); } } if (rollupMap.size() < facetFieldObject.getValues().size()) { facetFieldObject.setValues(rollupMap.values()); } } CaseInsensitiveFacet(String fieldName, FacetField.Count countObject);  CaseInsensitiveFacet(String fieldName, String facetValue);  CaseInsensitiveFacet(CaseInsensitiveFacet facet); @Override void setFieldName(String fieldName); String getSearchName(); void setSearchName(String searchName); static void deduplicateCaseInsensitiveValues(FacetFieldObject facetFieldObject); @Override Object clone();  }### Answer:
@Test public void deduplicateTest() { List<GenericFacet> facetList = new ArrayList<GenericFacet>(); facetList.add(new CaseInsensitiveFacet("f", "aaa")); CaseInsensitiveFacet facet = new CaseInsensitiveFacet("f", "baa"); facet.setCount(2); facetList.add(facet); facet = new CaseInsensitiveFacet("f", "BBa"); facet.setCount(16); facetList.add(facet); facet = new CaseInsensitiveFacet("f", "bba"); facet.setCount(1); facetList.add(facet); facet = new CaseInsensitiveFacet("f", "bBa"); facet.setCount(2); facetList.add(facet); facetList.add(new CaseInsensitiveFacet("f", "dDd")); facetList.add(new CaseInsensitiveFacet("f", "ddd")); facet = new CaseInsensitiveFacet("f", "ccc"); facet.setCount(3); facetList.add(facet); FacetFieldObject facetFieldObject = new FacetFieldObject("f", facetList); CaseInsensitiveFacet.deduplicateCaseInsensitiveValues(facetFieldObject); assertEquals(5, facetFieldObject.getValues().size()); assertEquals("aaa", facetFieldObject.getValues().get(0).getDisplayValue()); assertEquals(0, facetFieldObject.getValues().get(0).getCount()); assertEquals("baa", facetFieldObject.getValues().get(1).getDisplayValue()); assertEquals(2, facetFieldObject.getValues().get(1).getCount()); assertEquals("BBa", facetFieldObject.getValues().get(2).getDisplayValue()); assertEquals(19, facetFieldObject.getValues().get(2).getCount()); assertEquals("dDd", facetFieldObject.getValues().get(3).getDisplayValue()); assertEquals(0, facetFieldObject.getValues().get(3).getCount()); assertEquals("ccc", facetFieldObject.getValues().get(4).getDisplayValue()); assertEquals(3, facetFieldObject.getValues().get(4).getCount()); }