Why is StringTokenizer deprecated?

donnyton picture donnyton · Aug 8, 2011 · Viewed 55.2k times · Source

The Java documentation doesn't seem to mention anything about deprecation for StringTokenizer, yet I keep hearing about how it was deprecated long ago. Was it deprecated because it had bugs/errors, or is String.split() simply better to use overall?

I have some code that uses StringTokenizer and I am wondering if I should seriously be concerned about refactoring it to use String.split(), or whether the deprecation is purely a matter of convenience and my code is safe.

Answer

nicholas.hauschild picture nicholas.hauschild · Aug 8, 2011
  1. Java 10 String Tokenizer -- not deprecated
  2. Java 9 String Tokenizer -- not deprecated
  3. Java 8 String Tokenizer -- not deprecated
  4. Java 7 String Tokenizer -- not deprecated
  5. Java 6 String Tokenizer -- not deprecated
  6. Java 5 String Tokenizer -- not deprecated

If it is not marked as deprecated, it is not going away.