Why? A tokenizer is legacy code, which you ought not to use in new code. Why are you not using something like Scanner instead, which will find the next int directly.Erandika Gun wrote:. . . I used a BufferedReader and StringTokenizer for this. . . .
Campbell Ritchie wrote: Why are you not using something like Scanner instead
Campbell Ritchie wrote:
Why? A tokenizer is legacy code, which you ought not to use in new code. Why are you not using something like Scanner instead, which will find the next int directly.Erandika Gun wrote:. . . I used a BufferedReader and StringTokenizer for this. . . .
Do you really mean “learning”?Erandika Gun wrote:. . . I am learning to code through Algorithm contests which requires speed over ease.
Campbell Ritchie wrote:
Do you really mean “learning”?Erandika Gun wrote:. . . I am learning to code through Algorithm contests which requires speed over ease.
Erandika Gun wrote:I am learning to code through Algorithm contests which requires speed over ease.
Dennis Deems wrote:no award in Java for the code that uses the fewest keystrokes
There have been errors in the forum software which changes < to ><, so that might not be what was actually posted.Dennis Deems wrote:There is no such operator as "><=". . . .
If you are learning for speed, you are most probably learning it wrong. Also, the best way to get speed out of Java™ is not to code for speed.Erandika Gun wrote: . . . Not actually the basics, but the more salient points:).
Junilu Lacar wrote:
Erandika Gun wrote:I am learning to code through Algorithm contests which requires speed over ease.
So if you win something from advice you get here, will you donate a portion of your winnings to us, to be used towards the upkeep of the site?
Speed over ease, huh... so the idea is to buy now and pay later, too?
Campbell Ritchie wrote:Where did it say that buffered readers and tokenizers were quicker? How old was that reference? Have you tested it? How do you know it is accurate?
You need to be circumspect about weird things you find on the net. Here, too, though we usually find errors quite quickly!
Donald Knuth wrote:Premature optimization is the root of all evil
Did you just should on me? You should read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|