Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 4
    StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead. Commented Jun 12, 2012 at 17:07
  • 4
    Just because it's legacy doesn't mean it's not useful. And in fact, this particular class is actually very useful for that extra performance boost so I am actually against this "legacy" label. Commented Jun 12, 2012 at 17:09
  • 5
    The split method of String and the java.util.regex package incur the significant overhead of using regexes. StringTokenizer does not. Commented Jun 12, 2012 at 17:09
  • 2
    @tskuzzy it doesn't matter whether you are against "legacy" label or not, as javadoc says: its use discouraged. Commented Jun 12, 2012 at 17:17
  • 2
    @NandkumarTekale You did not apparently understand my point. But if you want to avoid using "legacy" classes in favor of "slow" ones that is your choice. Commented Jan 22, 2014 at 16:00