ArrayList in J2ME?

天大地大妈咪最大 提交于 2019-12-18 06:57:46

问题


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.


回答1:


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




回答2:


J2ME has Vector, which is the same as ArrayList, but all its methods are synchronized (a little bit slower).




回答3:


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


来源:https://stackoverflow.com/questions/3343212/arraylist-in-j2me

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!