Array toString()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Array toString()

jstngoulet
What is the best way to create a toString() for an array?

I would think that you would iterate through an array until the value is null, but what if you pass an object through? JACK doesn't use generics, so I am kinda stuck in creating my ArrayList class with the given tools.


Eat, Sleep, CODE, Repeat
(Only life is null)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array toString()

ybakos
Could you be more specific? For an array or your own ArrayList implementation?

What do you mean by "pass an object through"?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Array toString()

jstngoulet
I was looking for a standard Array Implementation. If I could figure out how to accomplish that task, I could work that with my ArrayList class.

"Passing an object through " comes down to reasoning of creating an array of objects. If I were to add objects to an array, how would I be a able to print their information on the screen? Would I have to just use the cmds:

var Array tempArr;
var Date tempDate;
let tempArr = Array.new(3);

let tempArr[0] = Date.new(02, 20, 2014);
let tempArr[1] = Date.new(01, 15, 2003);

let tempdate = tempArr[0];

do Output.printString(tempDate.toString());

? But having to use a while loop to iterate through each possible?


Eat, Sleep, CODE, Repeat
(Only life is null)
Loading...