private static ImmutableList < ImportTree > getWildcardImports ( List < ? extends ImportTree > imports ) { ImmutableList . Builder < ImportTree > result = ImmutableList . builder ( ) ; for ( ImportTree tree : imports ) { // javac represents on-demand imports as a member select where the selected name is '*'. Tree ident = tree . getQualifiedIdentifier ( ) ; if ( ! ( ident instanceof MemberSelectTree ) ) { continue ; } MemberSelectTree select = ( MemberSelectTree ) ident ; if ( select . getIdentifier ( ) . contentEquals ( "*" ) ) { result . add ( tree ) ; } } return result . build ( ) ; }
Collect all on demand imports .