Vector or ArrayList?

Hi
The J2ME-Polish framework provides an implementation of ArrayList. I am concerned in our project about the resource usage. Does anybody of you has experience with the ArrayList? Does it use less resources than the Vector?
Kind regards
Michael

Hi
The docs from J2ME Polish state that "de.enough.polish.util.ArrayList offers a fast alternative for Vector." I don't think though you would notice any difference when using one or another; you would have to make heavy use of this classes, which is not indicated in J2ME.
I don't know if we can apply the J2SE concepts for this two classes, but you should read this article and decide what to use: http://www.javaworld.com/javaworld/javaqa/2001-06/03-qa-0622-vector.html
Mihai

Similar Messages

  • Vector or ArrayList  use for dropdown with more than 1000 entries

    Hi Friends
    I am having more than 1000 entries of different TimeZone's which i need to display in a dropdown list.
    i am not able to decide whether i need to use a Vector or Arraylist for storing these values.
    please let me know which one will be best suited to use in case the list entry is more than 1000 characters.
    waiting for a positive reply from your side.
    Thanks & Regards
    Vikeng

    A JComboBox can be constructed from a Vector (rather than any other sort of List) without having to implement your own ComboBoxModel. (JList is similar).
    I agree with kajbj - a control like this with a thousand entries is rather poor interface design. One exception might be if the entries are sorted in some way, and you "jump" to the appropriate place in the list as the user types.

  • Storing Coordinates as integers in a Vector or ArrayList??

    Greetings all,
    I am trying to store a set of (x,y) coordinates in either a vector or an arraylist but don't really know which one is better or really the proper way to be doing it ... from my understanding firstly these numbers are stored as objects rather than integers, but i need them as integers because i would like to plug them into equations etc., from my understanding of vectors the code is something like this:
    Vector v = new Vector();
    v.addElement(0);
    v.addElement(1);
    v.addElement(2);
    v.addElement(3);which results in a vector like v=[0,1,2,3] which if i'm not mistaken are objects not integers, but what if i want a vector which stores numbers as v=[(0,0), (1,0), (2,0), (3,0)] that are integers?
    Your help is much appreciated.
    Thanks.

    Take the collections tutorial: [http://java.sun.com/docs/books/tutorial/collections/index.html]
    Prefer collections framework classes like ArrayList over older legacy classes like Vector.
    demo:
    import java.awt.Point;
    import java.util.*;
    public class ListExample {
        public static void main(String[] args) {
            List<Point> points = new ArrayList<Point>();
            points.add(new Point(1,2));
            points.add(new Point(5,3));
            System.out.println(points);
    }

  • 2D Vector or ArrayList

    Evening,
    Is there anything like a 2D Array in the ArrayList or Vector??

    Hi All.
    I am translating soem code from C++ to JAVA.
    in C++, I used vector< vector <int> > to create a sparse matrix / 2D array.
    I know you can make a vector of vectors in JAVA but i have been unable to get the individual elements. For example. I have:
    =========================
    Vector matrix = new Vector();
    for(){
    Vector row = new Vector();
    ... Do some to initiate row so that it has size > 1...
    matrix.add(row);
    =========================
    I can only do matrix.get(int), which gives me the entire row, but i can't do matrix.get(int).get(int) etc.... is there any way I can extract the[i] i,j element if a sparse matrix is set up this way or would i have to totally restructure?
    Thanks

  • Vector vs ArrayList

    Is it better to use a Vector or an ArrayList to store objects?? and why?

    If you have multiple Threads and they access the same ArrayList, you can run into concurrency problems because the structure is not synchronized. Vector doesn't have this problem, all of its methods are sync. Using the ArrayList external sync call will make it about as slow as a Vector, if not slower.
    http://java.sun.com/docs/books/cp/
    The book on concurrent programming.
    http://g.oswego.edu
    The site on concurrent programming.. util.concurrent

  • Using a vector / array/ arraylist. .   something!  . . . to return an image

    I'm trying to create a class with a method that randomly returns one of five images. I can't figure out how to do it. Everything I try goes wrong because I can't figure out what kind of object to create in the method. My latest attempt (below) was with ArrayList, but the compiler keeps telling me:
    smallPix2.java:32: array required, but java.util.ArrayList found
         return icons[num];
    Here's the code. Any feedback appreciated:
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    //import java.util.ArrayList;
    //import java.util.Arrays;
    //import java.util.Random;
    public class smallPix2 extends JFrame {
         ImageIcon img1 = new ImageIcon("Art//boutet.jpg");
         ImageIcon img2 = new ImageIcon("Art//curlu.jpg");
         ImageIcon img3 = new ImageIcon("Art//helleu.jpg");
         ImageIcon img4 = new ImageIcon("Art//ranson.jpg");
         ImageIcon img5 = new ImageIcon("Art//zamora.jpg");
    ImageIcon picks() {
         ArrayList icons = new ArrayList();
         icons.add(img1);
         icons.add(img2);
         icons.add(img3);
         icons.add(img4);
         icons.add(img5);
         Random rando = new Random();
         int num = rando.nextInt(5);
         return icons[num];
    }

    you have defined icons to be an ArrayList. So to reterieve data from it you should use its get() method.
    icons.get(num);if you look at the ArrayList API, this will return a type Object. You obviosly want to return an ImageIcon, and seeings you know that they are ImageIcons in there you can cast the object to ImageIcon:
    return (ImageIcon)icons.get(num);

  • How to use Vector or other ArrayList etc to store my JTree??

    How to use Vector or other ArrayList etc to store my JTree??
    Dear friends,
    I have following I posted before, but not get satisfactory answer, so I modify and repost again here.
    I have following code can add classes and students in the JTree,
    in class Computer Science, it has student Bill Brien,
    in Math, no,
    Then I I add Student Nancy, Laura, Peter into Computer Science Class,
    add AAAA, BBB, CCC into Math class,
    I create a new class called Chemistry, then I add DDD int Chemistry;
    so this JTree is dynamically changed,
    [1]. How can I dynamically save my current JTree with all above tree structure and its nodes in a Vector or ArrayList(not sure which one is best)??
    see code below:
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    public class ModelJTreeTest extends JFrame {
      private JTree tree;
      private DefaultTreeModel model;
      private DefaultMutableTreeNode rootNode;
      public ModelJTreeTest() {
        DefaultMutableTreeNode philosophersNode = getPhilosopherTree();
        model = new DefaultTreeModel(philosophersNode);
        tree = new JTree(model);
        JButton addButton = new JButton("Add Class/Students");
        addButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            addPhilosopher();
        JButton removeButton = new JButton("Remove Selected Class/Students");
        removeButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            removeSelectedPhilosopher();
        JPanel inputPanel = new JPanel();
        inputPanel.add(addButton);
        inputPanel.add(removeButton);
        Container container = getContentPane();
        container.add(new JScrollPane(tree), BorderLayout.CENTER);
        container.add(inputPanel, BorderLayout.NORTH);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(400, 300);
        setVisible(true);
      private void addPhilosopher() {
        DefaultMutableTreeNode parent = getSelectedNode();
        if (parent == null) {
          JOptionPane.showMessageDialog(ModelJTreeTest.this, "Select Class", "Error",
              JOptionPane.ERROR_MESSAGE);
          return;
        String name = JOptionPane.showInputDialog(ModelJTreeTest.this, "Add Class/Students:");
        model.insertNodeInto(new DefaultMutableTreeNode(name), parent, parent.getChildCount());
      private void removeSelectedPhilosopher() {
        DefaultMutableTreeNode selectedNode = getSelectedNode();
        if (selectedNode != null)
          model.removeNodeFromParent(selectedNode);
      private DefaultMutableTreeNode getSelectedNode() {
        return (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
      private DefaultMutableTreeNode getPhilosopherTree() {
        DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Students");
        DefaultMutableTreeNode ancient = new DefaultMutableTreeNode("Computer Science");
        rootNode.add(ancient);
        ancient.add(new DefaultMutableTreeNode("Bill Brian"));
        DefaultMutableTreeNode math = new DefaultMutableTreeNode("Maths");
        rootNode.add(math);  
        DefaultMutableTreeNode physics = new DefaultMutableTreeNode("Physics");
        rootNode.add(physics);
        return rootNode;
      public static void main(String args[]) {
        new ModelJTreeTest();
    }the actual Tree dynamically created somehow looks like following:
                             |            1.Peter
                             |---CS---    2. Nancy
                             |            3. Laura
                             |            4.Brian
                             |
    Root(University): -------|---Math- 1.AAA
                             |            2.BBB
                             |            3.CCC
                             |
                             |
                             |---Chemistry- 1. DDDThanks a lot
    Good weekends

    you can't directly store a tree in a list.Ummm... Just to be contrary... Yes you CAN store a tree in a table.... In fact that's how the windows file system works.
    Having said that... you would be well advised to investigate tree data-structures before resorting to flattening a tree into a list.
    So... Do you have a specific requirement to produce a List? Your umming-and-erring about Vector vs ArrayList makes it sound like you're still at the stage of choosing a datastructure.
    Cheers. Keith.

  • ArrayList v/s Vector

    Which is more beneficial to use?
    ArrayList or a Vector?
    Both are dynamic arrays,so which is more
    preferable to use?
    Can anyone help please?

    The Performance of Java's Lists
    Vector or ArrayList -- which is better?

  • Retrieving datas with ArrayList

    Below, im trying to get 6 columned records from the access database.
    //PNL 1:
                                  PNL1=new JPanel();
                                  PNL1.setLayout(new BorderLayout(15,15));
                                                    java.awt.List veri;
                                                    ArrayList veri2;
                                  lblABaslik=new JLabel("Arama Sonuclari :");
                                  String[] sutunAdlari={"Tarih","Arac","Kategori","Aciklama","Detay","Miktar"};
                                  int sayac=-1;
                                  java.util.Date tarih;int arac;int kategori;int aciklama;String detay;int tutar;
                                       try {
                                            String url="jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=..\\bekir.mdb";
                                            String query="select * from harcamalar where tarih between # 2003-11-14 # and #2003-12-14 #";
                                            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                            Connection con=DriverManager.getConnection(url,"serdar","serdar");
                                            Statement stmt=con.createStatement();
                                            ResultSet rs = stmt.executeQuery(query);
                                                                     veri=new java.awt.List(6);
                                                                     veri2=new ArrayList();
                                                                     String ekle;
                                                                     while(rs.next()) {
                                                                       ekle=new String(rs.getString("tarih"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("arac_id"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("kategori_id"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("aciklama_id"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("detay"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("miktar"));
                                                                           veri.add(ekle);
                                                                     veri2.add(veri);
                                            rs.close();
                                            stmt.close();
                                            con.close();
                                       catch (ClassNotFoundException e2){
                                            e2.printStackTrace(System.err);
                                       catch (SQLException e2){
                                       System.err.println("SQL state: " + e2.getSQLState());
                                       System.err.println("SQL error: " + e2.getErrorCode());
                                       e2.printStackTrace(System.err);
                                                    table=new JTable(veri2,sutunAdlari);
                                  table.setPreferredScrollableViewportSize(new Dimension(600,100));
                                  JScrollPane scrollpane=new JScrollPane(table);
                                  PNL1.add("North",lblABaslik);
                                  PNL1.add("Center",scrollpane);
                                  table.addMouseListener(new MouseAdapter() {
                                       public void mouseClicked(MouseEvent e) {
                                            System.out.println(table.getSelectedRow());
    but i get the error :
    "BekirAna2.java": cannot resolve symbol: constructor JTable (java.util.ArrayList,java.lang.String[])in class javax.swing.JTable at line 1928, column 55
    which represents the line :
    table=new JTable(veri2,sutunAdlari);
    thanx

    i changed the codes with Vector definitions;
                             //PNL1 :
                                  PNL1=new JPanel();
                                  PNL1.setLayout(new BorderLayout(15,15));
                                                     Vector veri;
                                                     Vector veri2;
                                                     //ArrayList veri2;
                                  lblABaslik=new JLabel("Arama Sonuclari :");
                                  //Object[][] veri=new Object[10][7];
                                  //veri[0][0] = new String("foo"); //etc.
                                  String[] sutunAdlari={"Tarih","Arac","Kategori","Aciklama","Detay","Miktar"};
                                  int sayac=-1;
                                  java.util.Date tarih;int arac;int kategori;int aciklama;String detay;int tutar;
                                       try {
                                            String url="jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=..\\bekir.mdb";
                                            //String query="select * from harcamalar";
                                            String query="select * from harcamalar where tarih between # 2003-11-14 # and #2003-12-14 #";
                                            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                            Connection con=DriverManager.getConnection(url,"serdar","serdar");
                                            Statement stmt=con.createStatement();
                                            ResultSet rs = stmt.executeQuery(query);
                                                                     veri=new Vector();
                                                                     //veri2=new ArrayList();
                                                                     veri2 = new Vector();
                                                                     String ekle;
                                                                     while(rs.next()) {
                                                                       ekle=new String(rs.getString("tarih"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("arac_id"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("kategori_id"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("aciklama_id"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("detay"));
                                                                           veri.add(ekle);
                                                                       ekle=new String(rs.getString("miktar"));
                                                                           veri.add(ekle);
                                                                     veri2.add(veri);
                                            rs.close();
                                            stmt.close();
                                            con.close();
                                       catch (ClassNotFoundException e2){
                                            e2.printStackTrace(System.err);
                                       catch (SQLException e2){
                                       System.err.println("SQL state: " + e2.getSQLState());
                                       System.err.println("SQL error: " + e2.getErrorCode());
                                       e2.printStackTrace(System.err);
                                  //table=new JTable(veri,sutunAdlari);
                                                    table=new JTable(veri2,sutunAdlari);
                                  table.setPreferredScrollableViewportSize(new Dimension(600,100));
                                  JScrollPane scrollpane=new JScrollPane(table);
                                  PNL1.add("North",lblABaslik);
                                  PNL1.add("Center",scrollpane);
                                  table.addMouseListener(new MouseAdapter() {
                                       public void mouseClicked(MouseEvent e) {
                                            System.out.println(table.getSelectedRow());
                                  });but i still get the error alike:
    "BekirAna2.java": cannot resolve symbol: constructor JTable (java.util.Vector,java.lang.String[])in class javax.swing.JTable at line 1931, column 55
    pointing the line;
    table=new JTable(veri2,sutunAdlari);

  • Use of Vector in undo operation ?

    Hello,
    I am developing simple paint program. And want to use undo redo operation for drawing in drawing canvas. Actually I have done it with the help of Vector. But the problem is that it is not working properly. The first drawn shape is not removing with this operation and also the problem is that When i am using CTRL+Z for undoing last drawing. It is not removing last drawn shape with first undo operation. Let me know that what is the exact problem in my coding. I am not fully java programmer. So please tell me what to do for that. I want to draw n level of drawing on drawing canvas and also want to perform n level (first drawn shape) undo actions. And also want to know how to make redo button for same coding only use of Vector or ArrayList.
    My code is here:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import javax.swing.*;
    import java.util.*;
    public class PaintUndo extends JFrame
         Display pan = new Display();
    public PaintUndo()
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);}});
         getContentPane().add("Center",pan);
           setBounds(1,1,600,400);
         JMenuBar  menu = new JMenuBar();;
         JMenu     submenu;
         JMenuItem item, redo;
         submenu = new JMenu("Edit");     
         item = new JMenuItem("UnDo");
        item.setMnemonic(KeyEvent.VK_Z);
            item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, ActionEvent.CTRL_MASK));
         item.addActionListener((ActionListener)pan);
         submenu.add(item);   
         menu.add(submenu);
         getContentPane().add("North",menu);
         setVisible(true);
    public class Display extends JComponent implements MouseMotionListener, MouseListener, ActionListener
         Vector   saves = new Vector();
         BufferedImage image = null;
         Graphics ig;
         Graphics pg;
         Point point;
        int x1=0;
        int y1=0;
    public Display()
         setBackground(Color.pink);
         addMouseMotionListener(this);
        addMouseListener(this);
    public void paintComponent(Graphics g)
         if (image == null)
              image = (BufferedImage) createImage(800,600);
              ig = image.createGraphics();
              ig.setColor(Color.white);
              ig.fillRect(0,0,800,600);
              ig.setColor(Color.blue);
              pg = getGraphics();
              pg.setColor(Color.blue);
         g.drawImage(image,0,0,this);
    public void mouseDragged(MouseEvent e)
            int x2 = e.getX(); int y2 = e.getY();
                Graphics gr = image.getGraphics();
                   gr.drawLine(x1, y1, x2, y2);
                repaint();
                x1 = x2; y1 = y2;
    public void mouseMoved(MouseEvent e)
    public void actionPerformed(ActionEvent a)
         if (a.getActionCommand().equals("UnDo") && saves.size() > 0)
              ig.drawImage((Image)saves.remove(saves.size()-1),0,0,null);
              repaint();
            public void mouseClicked(MouseEvent e) {
                System.out.println("mouse clicked....");
            public void mousePressed(MouseEvent e) {
                System.out.println("mouse pressed....");
                x1 = e.getX();
                   y1 = e.getY();
            public void mouseReleased(MouseEvent e) {
                System.out.println("mouse released....");
               Image tmg = createImage(800,600);
              Graphics tg = tmg.getGraphics();
              tg.drawImage(image,0,0,null);
              saves.add(tmg);
            public void mouseEntered(MouseEvent e) {
            public void mouseExited(MouseEvent e) {
    public static void main (String[] args)
         new PaintUndo();
    }This is complete code for undoing.
    Any help will be appreciated.
    Thanks in advance.
    Manveer

    The example code is set up for a protocol completely different than what you are doing, so you can't simply copy it and hope it works.  The example code expects that the other side will send a 4-byte header containing the number of data bytes that follow, then send the data.  The example code first reads that 4-byte header, casts it to an integer, and reads that number of bytes (the second Bluetooth Read).
    When you run this with your device, the first read gets your 4 bytes - FF FF 22 33 - and converts that to an integer.  0xFFFF2233 is decimal 4294910515.  So you then try to read this huge number of bytes and you get an error - looks like error 1, an input parameter is invalid, because you can't read 4GB at once.  You can probably get your code working with a single Bluetooth Read, with a 1 second timeout (because you have a 1 second delay between packets).  You'll want to wire in some number of bytes to read that is at least the size of the largest packet you ever expect, but don't use a ridiculously huge number that generates an error.  LabVIEW will return as many bytes as are available when the timeout expires, even if it isn't as many as you asked to read (you might also get a timeout error, though, which you'll need to clear).  You can then do whatever you need to do with that data - search for FF FF, typecast anything after that to array of U16, display it. 
    The output of the Bluetooth Read is a string, but it's not text - it's exactly the bytes that were sent.  The Y with the dots over it is the way ASCII 255 (0xFF) displays (at least in that font).  ASCII 34 (0x22) is ", and ASCII 51 (0x33) is the number 3.

  • Can i know what type of object is stored in Vector?

    i have written a program for vector where i am adding elements like
    sunday, monday , 3.14, 9,5.56 and i want to sum all elements of type double only double data type numbers. it should not add int number or string ?
    import java.util.*;
    class VectorBasic
         public static void main(String args[ ])
              Vector v1=new Vector(1);
              Double d1=new Double(3.14);
              v1.addElement(d1);
              v1.addElement("sunday");
              v1.addElement(new Integer(2));
              v1.addElement(new Double(5.56));     
              v1.addElement(new Integer(5));
              for (int i=0;i<v1.size();i++ )
              System.out.println(v1.elementAt(i));
    }

    Questions:
    1: Why are you using Vector? You should be using ArrayList in most new code. If you need synchronization (Vector is synchronized), use Collections.synchronizedList(). You don't need synchronization for the code you showed.
    2: Why initialize the size of Vector (or ArrayList) as 1? That just makes you have to reallocate the size of the list (done for you by the Vector class) as soon as you add a second element. Why not just use a new Vector() [or, better, a new ArrayList()] with the default size?
    3: Why are you mixing type in your Vector in the first place? Is this just a test class to learn how to tell the type of an object?
    Comment:
    1. You should use Double.valueOf(3.14) and Integer.valueOf(2), instead of calling "new Double(3.14)" and "new Double(2)".
    In the future, when posting code, use the code tags to keep it formatted nicely. There's a button for it above the posting box. Select your code, then press that "code" button. It will put code tags around your code. You can also type the tags manually--put one at the beginning of your code, and one at the end:

  • Vector  or Array List better usage

    Hi form
    For storage of large Object's Which is a better management API
    Vector OR ArrayList
    Please some one Enlightern me
    with regards
    Karthik

    Please some one Enlightern meObjects in Java are always handled using references (pointers) to the actual object values (which reside on the so called heap).
    So from the point of the size of the objects, Vector and ArrayList are equivalent. No object values are stored in them, only references to objects and references always have the same size.

  • ? with a Vector of LinkedLists

    Hi,
    I would like to create a Vector. Each element will be a LinkedList. Each element in my LinkedList will be an Object, call it o. Obejcts like o have a member field called time, which is a BigDecimal. I am doing this because I want each LinkedList to contain o's with the same time value. So if I index into the Vector at 0 I will get a linked list that has Objects of type o and all those objects have time value t0. If I index into the Vector at position x, I will get a LinkedList of objects having time value tx.
    Now, initially my Vector just contained the Objects of type o, so my class just had a method called compareTo() that would provide a natural ordering. This allowed me to do a Collections.binarySearch() when I wanted to insert into the vector.
    Currently I am a little confused as to how and where I will write the new compareTo() method. Basically I have a method that accepts objects of type o and what I want it to do would be to look at o's time field, then do Collections.binarySearch() on the Vector to find the index of the appropriate LinkedList. Then I will just insert into the LinkedList. But I see that the LinkedList class does not have it's own compareTo() method. If I were to write one I would have it simply call the compareTo() method on the first element in it's list.
    Thanks,
    Jeff

    Oh, ok. So you are basically implying that since my
    times will be arbitrary then my binarySearch into the
    Vector will cost more than just inserting a new
    LinkedList into a HashMap (or getting the already
    existing linked list from the HashMap). Makes sense.
    Thanks.Not necessarily that it will be computationally more expensive, just that the vector is a poorer representation of your intent. A Vector (actually, ArrayList would be better) or Array is useful for random access when you know the index. If you want a lookup by an arbitrary key, however, a Map is a more direct realization of your design.
    Under the covers, the Map could very well do a binary search on a List or array anyway, but your code shouldn't know or care about that detail. Your code should just say, as simply and directly as possible, "Give me the elemnts that have a time value of X". map.get(X) is a clean way to do that. Anybody reading the code later (including you, after you've forgotten WTF you were doing) will find that easier to understand than a binary search through a vector to find the list element whose first entry have time value X.

  • Binding arraylist, list, or multi-dimensional array to table in web dynpro

    Greetings,
    I like to ask if anyone knows how to bind data from an arraylist, list, or multi-dimensional array list to a table in web dynpro, your help is much appreciated.
    Thanks in advance.
    Cory

    Is there a way to create or cast a multi-dimensional
    array from a Collection or Vector ?
    ArrayList list = new ArrayList();
    list.add( new Object[4] );
    Object[] array2 = list.toArray(); // is only
    single dimension !
    Of course it is a single dimension array.
    Check the definition of the toArray() function, and the specification of arrays in general.
    toArray() returns a one dimensional array.
    In your case it will return an array of arrays. So array2[0] will be an array of 4 objects.
    That just happens to be a 2 dimensional array though you may (I haven't checked it) need some parentheses to call the elements.
    Try Object o = array2[0][1]; and if that doesn't work Object o = (array2[0])[1];

  • Vector created in Workflow need to use in form

    Hi,
    I have created Vector in WF and I need to use this vector in Form to display the values.
    I am able to see the values from vector in my action but in manual action I am unable to see the value. It shows as null.
    Is there any way to pass object from workflow to Form?
    Thanks in Advance
    MMK

    Form baseContext is variables.
    I changed Vector to ArrayList and its started working fine now.
    Thanks
    MMK

Maybe you are looking for

  • Can I install a DVDRW drive on my Satellite Pro A10?

    I would like to upgrade the DVD ROM/CDRW drive (SD-R2412) on my Satellite Pro A10 to a DVDRW drive so I can burn DVDs. I have purchased a Toshiba DVDRW drive (TS-L632), as it is exactly the same size and shape as the existing DVD ROM drive, the same

  • No bootable device... can't open Mac OS X or anything in fact! Help!

    got a new iMac and just used bootcamp to make a partition.  It was made successfully. but then i quit and didn't continue to install Windows.  After a shower, i guess my iMac went to sleep, but i couldn't wake it up using my apple keyboard or trackpa

  • Problem in catching UserException

    I have a problem in catching UserException in the JavaCard RMI demo of purse client from the Development Kit. The error that i'm getting is this, instead of catching the UserException: Exception in thread "main" java.lang.UnsatisfiedLinkError: com.su

  • Freelance contact - anyone know how to get one?

    Sorry, I don't know where else to ask this. Here's the scenario. I'm working on a very small website project and the person I'm making it for wants to make a contract. I have never done a contract before nor do I know where to obtain one... ir if I n

  • SDK download privileges

    I have successfully registered and downloaded the Photoshop SDK in the past. I am however denied access to the CS2 SDK. Does anybody know whether the privileges have changed for the SDK? Does one need to become an actual ASN member (again)?