Why does the chaos tutorial use a StringTokenizer rather than split ()?

In its _ WordCount_ tutorial , hasoop uses a StringTokenizer .

Is there a reason to use this rather than String.split() ?

+4
source share
1 answer

According to his own javadoc : No, no reason. StringTokenizer is an obsolete product, and it is recommended that you use String#split instead of this class.

StringTokenizer is an inherited class that is retained for compatibility reasons, although its use is not recommended in new code. It is recommended that anyone looking for this functionality use the split method for String or the java.util.regex package.

+5
source

Source: https://habr.com/ru/post/1490036/


All Articles