public String nextToken(){
  String result=null;
synchronized (this) {
    if (isEmpty()) {
      return null;
    }
 else {
      if (isEatingBlocksOfDelimiters) {
        trimStartingDelimiters();
      }
      int nearestDelimeter=-1;
      for (int i=0; i < delimiters.length(); i++) {
        int delimiter=source.indexOf(delimiters.charAt(i),currentIndex);
        if (nearestDelimeter == -1 || delimiter != -1 && delimiter < nearestDelimeter) {
          nearestDelimeter=delimiter;
        }
      }
      if (nearestDelimeter == -1) {
        result=source.substring(currentIndex);
        currentIndex=source.length();
      }
 else {
        result=source.substring(currentIndex,nearestDelimeter);
        currentIndex=nearestDelimeter + 1;
        if (isEatingBlocksOfDelimiters) {
          trimStartingDelimiters();
        }
      }
    }
  }
  return result;
}

public String nextToken ( ) { String result = null ; synchronized ( this ) { if ( isEmpty ( ) ) { return null ; } else { if ( isEatingBlocksOfDelimiters ) { trimStartingDelimiters ( ) ; } int nearestDelimeter = - 1 ; for ( int i = 0 ; i < delimiters . length ( ) ; i ++ ) { int delimiter = source . indexOf ( delimiters . charAt ( i ) , currentIndex ) ; if ( nearestDelimeter == - 1 || delimiter != - 1 && delimiter < nearestDelimeter ) { nearestDelimeter = delimiter ; } } if ( nearestDelimeter == - 1 ) { result = source . substring ( currentIndex ) ; currentIndex = source . length ( ) ; } else { result = source . substring ( currentIndex , nearestDelimeter ) ; currentIndex = nearestDelimeter + 1 ; if ( isEatingBlocksOfDelimiters ) { trimStartingDelimiters ( ) ; } } } } return result ; }
returns null if there is nothing left .
