I have created an object where I pass a string and a long value to it , currently I am adding the values to my Object so I can then add it to a list like so:
List myList;
ImageObject io;
for(i = 0; i < 10; i++)
{
io = new ImageObject("String", i);
myList.add(io);
}
This is what the object currently looks like:
public final class ImageObject<name, time>
{
开发者_Go百科 public String name = "";
public long time = 0;
public ImageObject(Object o)
{
// Think I need something here, but im not sure what!
}
public ImageObject(String name, long time)
{
this.name = name;
this.time = time;
}
public long getTime()
{
return this.time;
}
And this is how I would like to retrieve it:
{
ImageObject io;
Iterator i = lstPageImages.iterator();
while(i.hasNext())
{
io = new ImageObject(i.next());
log.printDebug("name: "+io.name+" time: "+io.time);
}
}
Does anybody have any ideas? Many thanks in advance.
trscookie.
Ah, Think I came up with a similar solution:
private List lstPageImages = new ArrayList<ImageObject>();
...
io = (ImageObject)i.next();
log.printDebug("name: "+io.name+" time: "+io.time);
Cheers for your help :D
精彩评论