【问题标题】:ArrayList in J2ME?J2ME 中的数组列表?
【发布时间】:2011-03-21 13:39:49
【问题描述】:

我有一个数据库记录数组列表。我想把它放在我的 J2ME 列表中。但是J2ME 中没有split 或arraylist。我该怎么做?一个代码示例会很好。

【问题讨论】:

    标签: java java-me


    【解决方案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);
    }
    

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • @ali - 你需要一个例子吗???只需像 J2SE 列表一样对其进行编码。
      【解决方案3】:

      最好使用Vector (java.util.Vector)。它会帮助你。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多