private static Set<String> createCategoriesSet(Set<String> categories){
  Set<String> result=new HashSet<>();
  for (  String cat : categories) {
    result.add(StringUtil.toLowerCase(cat));
  }
  return result;
}

private static Set < String > createCategoriesSet ( Set < String > categories ) { Set < String > result = new HashSet < > ( ) ; for ( String cat : categories ) { result . add ( StringUtil . toLowerCase ( cat ) ) ; } return result ; }
creates a new set with the given categories , making them all lowercase in the process . duplicate categories that were only differentiated by case will of course be reduced to one lowercase one by the set .
