private void process ( ImmutableSetMultimap < Class < ? extends Annotation > , Element > validElements ) { for ( ProcessingStep step : steps ) { ImmutableSetMultimap < Class < ? extends Annotation > , Element > stepElements = new ImmutableSetMultimap . Builder < Class < ? extends Annotation > , Element > ( ) . putAll ( indexByAnnotation ( elementsDeferredBySteps . get ( step ) , step . annotations ( ) ) ) . putAll ( filterKeys ( validElements , Predicates . < Object > in ( step . annotations ( ) ) ) ) . build ( ) ; if ( stepElements . isEmpty ( ) ) { elementsDeferredBySteps . removeAll ( step ) ; } else { Set < ? extends Element > rejectedElements = step . process ( stepElements ) ; elementsDeferredBySteps . replaceValues ( step , transform ( rejectedElements , new Function < Element , ElementName > ( ) { @ Override public ElementName apply ( Element element ) { return ElementName . forAnnotatedElement ( element ) ; } } ) ) ; } } }
Processes the valid elements including those previously deferred by each step .