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.
Asked
Active
Viewed 6,043 times
3 Answers
4
J2ME has Vector, which is the same as ArrayList, but all its methods are synchronized (a little bit slower).
Peter Mortensen
- 30,030
- 21
- 100
- 124
Roman
- 61,962
- 88
- 232
- 324
-
1@ali - you need an example for this??? Just code it the same as if it was a J2SE List. – Stephen C Jul 27 '10 at 13:08
4
It is better if you use Vector (java.util.Vector). It will help you.
Peter Mortensen
- 30,030
- 21
- 100
- 124
SIVAKUMAR.J
- 4,110
- 7
- 43
- 79
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);
}
Nicklas Ahlskog
- 21
- 2