protected Collection < String > filterIdentifiers ( Collection < String > identifiers ) { // Obtain enough space for a full copy of the given identifiers Collection < String > validIdentifiers = new ArrayList < String > ( identifiers . size ( ) ) ; // Add only valid identifiers to the copy for ( String identifier : identifiers ) { if ( isValidIdentifier ( identifier ) ) validIdentifiers . add ( identifier ) ; } return validIdentifiers ; }
Filters the given collection of strings returning a new collection containing only those strings which are valid identifiers . If no strings within the collection are valid identifiers the returned collection will simply be empty .