Replicating String.split with StringTokenizer

后端 未结 9 1247
心在旅途
心在旅途 2021-02-06 14:03

Encouraged by this, and the fact I have billions of string to parse, I tried to modify my code to accept StringTokenizer instead of String[]

The only t

9条回答
  •  面向向阳花
    2021-02-06 14:51

    If your input is structured, you can have a look at the JavaCC compiler. It generates a java class reading your input. It would look like this:

    TOKEN {  ,  }
    
    input: (cat() | dog())*
    
    
    cat: 
       {
       animals.add(new Animal("Cat"));
       }
    
    dog: 
       {
       animals.add(new Animal("Dog"));
       }
    

提交回复
热议问题