Code example for Scanner

Methods: hasNextnext

0
       Useful for dealing with the syntactic elements of the language 
       which do not have semantic content, and are there only to 
       make the language parsable. 
	 */ 
	public static boolean gobble(String p, Scanner s){
		if (s.hasNext(p)) { s.next(); return true;}
		else { return false; } 
	} 
	public static boolean gobble(Pattern p, Scanner s){
		if (s.hasNext(p)) { s.next(); return true;}
		else { return false; } 
	} 
 
 
} 
 
// You could add the node classes here, as long as they are not declared public (or private) 
Contextual code suggestions in your IDE  Get Codota for Java