【发布时间】:2011-03-21 13:39:49
【问题描述】:
我有一个数据库记录数组列表。我想把它放在我的 J2ME 列表中。但是J2ME 中没有split 或arraylist。我该怎么做?一个代码示例会很好。
【问题讨论】:
我有一个数据库记录数组列表。我想把它放在我的 J2ME 列表中。但是J2ME 中没有split 或arraylist。我该怎么做?一个代码示例会很好。
【问题讨论】:
http://docs.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/java/util/Vector.html
public void asd(){
MyObject mo = new MyObject();
Vector v = new Vector();
//Adds the specified component to the end of this vector, increasing its size by one.
v.addElement(mo);
//Returns the component at the specified index.
mo = (MyObject)v.elementAt(0);
}
【讨论】:
J2ME 有Vector,与ArrayList 相同,但它的所有方法都是同步的(有点慢)。
【讨论】:
最好使用Vector (java.util.Vector)。它会帮助你。
【讨论】: