question: private static Map < NonTerminal , List < Production > > calcProductionsStartingWith ( Grammar gr ) { final HashMap < NonTerminal , List < Production > > productionsStartingWith = new HashMap < NonTerminal , List < Production > > ( ) ; for ( NonTerminal nonTerminal : gr . getNonTerminals ( ) ) { final List < Production > list = new LinkedList < Production > ( ) ; for ( Production p : gr . getProductions ( ) ) { if ( p . getLHS ( ) == nonTerminal ) list . add ( p ) ; } productionsStartingWith . put ( nonTerminal , Collections . unmodifiableList ( list ) ) ; } return productionsStartingWith ; }
target:  Build map NonTerminal (1) -> (*) productions (starting with NonTerminal)