Swastik
Nik Recort wrote:But here it doesn't seem to work.
Nik Recort wrote:But here it doesn't seem to work.
Junilu Lacar wrote:Finally, you can use the java.util.Arrays class to conveniently create a List:
Zach Rode wrote:If I remember right this creates a List object and not an ArrayList which he was looking for. You can change it to an ArrayList by wrapping it in a constructor though
Zach Rode wrote:Implementation type could matter also if ArrayList overrides List methods.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Indeed, for ArrayLists you have the method 'removeRange', that ia not available for a List. Likewise, a TreeSet has a very useful method 'ceiling' (and 'floor'), that is not in a Set. There may be more of those, but these are the ones I encountered so far.
Nik Recort wrote: I have also removed the capital letter from "techniques):
You wrote:I get errors in line 19 and 20
Junilu Lacar wrote:TIP: Use the Preview button before posting a message so you can see the line numbers in the code that you post inside code tags. Then you can reference the correct line numbers.
You wrote:I get errors in line 19 and 20
... actually, lines 11 and 12 in the code you posted.
You wrote techniques.size instead of techniques.size().
And again, you might want to use java.util.Random instead of Math.random(). The code is much clearer when you use Random.
Nik Recort wrote:Is it still convenient to add this line?
. . . but this is quicker to write:-Junilu Lacar wrote:. . . . There's really no point in these lines since you use those variables only one time: . . .
Campbell Ritchie wrote:. . . but this is quicker to write:-
βThe strongest of all warriors are these two β Time and Patience.β β Leo Tolstoy, War and Peace
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |