public static <T>void updateMappingToImmutableSet(Map<T,Set<AnnotationMirror>> map,T key,Set<AnnotationMirror> newQual){
  Set<AnnotationMirror> result=AnnotationUtils.createAnnotationSet();
  if (!map.containsKey(key)) {
    result.addAll(newQual);
  }
 else {
    result.addAll(map.get(key));
    result.addAll(newQual);
  }
  map.put(key,Collections.unmodifiableSet(result));
}

public static < T > void updateMappingToImmutableSet ( Map < T , Set < AnnotationMirror > > map , T key , Set < AnnotationMirror > newQual ) { Set < AnnotationMirror > result = AnnotationUtils . createAnnotationSet ( ) ; if ( ! map . containsKey ( key ) ) { result . addAll ( newQual ) ; } else { result . addAll ( map . get ( key ) ) ; result . addAll ( newQual ) ; } map . put ( key , Collections . unmodifiableSet ( result ) ) ; }
see checkers . types . qualifierhierarchy # updatemappingtomutableset ( qualifierhierarchy , map , object , annotationmirror ) ( not linked because it is in an independent project .
