我创建了一个对象,我将一个字符串和一个long值传递给它,目前我正在将值添加到我的Object中,然后我可以将它添加到一个列表中,如下所示:
List myList;
ImageObject io;
for(i = 0; i < 10; i++)
{
io = new ImageObject("String", i);
myList.add(io);
}
这是目前的对象:
public final class ImageObject<name, time>
{
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;
}
这就是我想要检索它的方式:
{
ImageObject io;
Iterator i = lstPageImages.iterator();
while(i.hasNext())
{
io = new ImageObject(i.next());
log.printDebug("name: "+io.name+" time: "+io.time);
}
}
有人有什么想法吗?非常感谢提前。
trscookie。
答案 0 :(得分:0)
private List lstPageImages = new ArrayList<ImageObject>();
...
io = (ImageObject)i.next();
log.printDebug("name: "+io.name+" time: "+io.time);
为你的帮助干杯:D