ArrayList in J2ME?
Asked Answered
S

3

3

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.

Sharanshard answered 27/7, 2010 at 11:42 Comment(0)
D
4

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

Dragon answered 30/11, 2010 at 6:6 Comment(0)
F
4

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

Fulminant answered 27/7, 2010 at 11:44 Comment(1)
@ali - you need an example for this??? Just code it the same as if it was a J2SE List.Countersign
D
4

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

Dragon answered 30/11, 2010 at 6:6 Comment(0)
E
1

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);
}
Elveraelves answered 31/7, 2013 at 8:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.