简体   繁体   中英

ArrayList in J2ME?

I have an arraylist of database records. I want to put it in my J2ME List. But there is no split or arraylist in J2ME. How can I do it? A code example would be nice.

J2ME具有Vector ,它与ArrayList相同,但它的所有方法都是同步的(稍微慢一点)。

It is better if you use Vector ( java.util.Vector ). It will help you.

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM