static Map<TargetType,List<TypeCompound>> partitionByTargetType(Collection<TypeCompound> annos,List<TypeCompound> unmatched,TargetType... targetTypes){
  final Map<TargetType,List<TypeCompound>> targetTypeToAnnos=new HashMap<>();
  for (  TargetType targetType : targetTypes) {
    targetTypeToAnnos.put(targetType,new ArrayList<TypeCompound>(10));
  }
  for (  final TypeCompound anno : annos) {
    final List<TypeCompound> annoSet=targetTypeToAnnos.get(anno.getPosition().type);
    if (annoSet != null) {
      annoSet.add(anno);
    }
 else     if (unmatched != null) {
      unmatched.add(anno);
    }
  }
  return targetTypeToAnnos;
}

static Map < TargetType , List < TypeCompound > > partitionByTargetType ( Collection < TypeCompound > annos , List < TypeCompound > unmatched , TargetType ... targetTypes ) { final Map < TargetType , List < TypeCompound > > targetTypeToAnnos = new HashMap < > ( ) ; for ( TargetType targetType : targetTypes ) { targetTypeToAnnos . put ( targetType , new ArrayList < TypeCompound > ( 10 ) ) ; } for ( final TypeCompound anno : annos ) { final List < TypeCompound > annoSet = targetTypeToAnnos . get ( anno . getPosition ( ) . type ) ; if ( annoSet != null ) { annoSet . add ( anno ) ; } else if ( unmatched != null ) { unmatched . add ( anno ) ; } } return targetTypeToAnnos ; }
use a map to partition annotations with the given targettypes into lists , where each target type is a key in the output map . any annotation that does not have one of these target types will be added to unmatched
