I'm trying to write a recursive descent parser. I need a method that converts the string to a stream, so I can use a next method. Everywhere I read, it says that StreamTokenizer is outdated and unnecessary, but I can't find any alternatives.
.split() can be used but it doesn't quite give me the functionality I'm interested in - looping over the array and entering recursion will be complicated, I'll have to split and trim the array constantly. So my question is, what is the recommended alternative?
Thanks
currently, my solution is:
LinkedList<String> queue = new LinkedList<>(Arrays.asList(rule.split(" "))); //splits to spaces and gives me q
where rule is a string.
-
Where exactly do you see that StreamTokenizer is deprecated?rici– rici2021-03-19 19:42:22 +00:00Commented Mar 19, 2021 at 19:42
Add a comment
|