parsing - Scala equivalent of java.util.Scanner -
i familiar using java.util.scanner
next()
, hasnext()
, nextint()
, nextline()
, , parse input.
is there else should use in scala?
this data isn't structured according grammar; it's more ad-hoc that.
for example, lets had inventory. each line of input starts name, has quantity of items, has ids items
firetruck 2 a450m a451m machine 1 qzlt keyboard 0
i see console
has methods such readint()
, reads entire line of input; equivalent of nextint()
doesn't seem exist.
java.util.scanner
trick. there else should use (for example, returns scala rather java types)?
no there no equivalent scala implementation. don't see reason 1 java.util.scanner work fine , java primitives types converted scala types implicitly.
so "for example, returns scala rather java types", scanner return scala types when used in scala.
Comments
Post a Comment