public static Token findFirst ( final String name , final List < Token > tokens , final int index ) { for ( int i = index , size = tokens . size ( ) ; i < size ; i ++ ) { final Token token = tokens . get ( i ) ; if ( token . name ( ) . equals ( name ) ) { return token ; } } throw new IllegalStateException ( "name not found: " + name ) ; }
Find the first token with a given name from an index inclusive .