Use isEmpty() instead of size()==0, specify generic arguments

This commit is contained in:
Sam Harwell 2012-07-13 14:33:42 -05:00
parent 683b915507
commit 96654531b7
1 changed files with 2 additions and 2 deletions

View File

@ -758,7 +758,7 @@ public class Grammar implements AttributeResolver {
Map<String,String> lexerRuleToStringLiteral = new HashMap<String,String>(); Map<String,String> lexerRuleToStringLiteral = new HashMap<String,String>();
List<GrammarAST> ruleNodes = ast.getNodesWithType(ANTLRParser.RULE); List<GrammarAST> ruleNodes = ast.getNodesWithType(ANTLRParser.RULE);
if ( ruleNodes==null || ruleNodes.size()==0 ) return null; if ( ruleNodes==null || ruleNodes.isEmpty() ) return null;
for (GrammarAST r : ruleNodes) { for (GrammarAST r : ruleNodes) {
//tool.log("grammar", r.toStringTree()); //tool.log("grammar", r.toStringTree());
@ -782,7 +782,7 @@ public class Grammar implements AttributeResolver {
TreeWizard wiz, TreeWizard wiz,
Map<String, String> lexerRuleToStringLiteral) Map<String, String> lexerRuleToStringLiteral)
{ {
HashMap nodes = new HashMap(); HashMap<String, Object> nodes = new HashMap<String, Object>();
if ( wiz.parse(r, pattern, nodes) ) { if ( wiz.parse(r, pattern, nodes) ) {
GrammarAST litNode = (GrammarAST)nodes.get("lit"); GrammarAST litNode = (GrammarAST)nodes.get("lit");
GrammarAST nameNode = (GrammarAST)nodes.get("name"); GrammarAST nameNode = (GrammarAST)nodes.get("name");