title: Why are my Vectors making duplicates?
body: <p>I would like to know why are my vectors making duplicates? I know i can use ArrayList, but this is a test for my blackberry app that only uses vectors at the moment. This is the result i continue to get:</p>
  
  <pre><code>ID:3 and Name:Catty and Price:100 and Msg:Catty is a preety girl
  ID:3 and Name:Catty and Price:100 and Msg:Catty is a preety girl
  ID:3 and Name:Catty and Price:100 and Msg:Catty is a preety girl
  </code></pre>
  
  <p>Here is the code, <strong>testapp.java</strong></p>
  
  <pre><code>package testing;
  
  import java.util.Vector;
  
  
  public class testapp {
      private static Vector&lt;String&gt; listElements= new Vector&lt;String&gt;();
      private static Vector&lt;String&gt; listName= new Vector&lt;String&gt;();
      private static Vector&lt;Integer&gt; listPrice= new Vector&lt;Integer&gt;();
      private static Vector&lt;String&gt; listDate= new Vector&lt;String&gt;();
      private static Vector&lt;String&gt; listAbstract= new Vector&lt;String&gt;();
      private static Vector&lt;rec&gt; a = new Vector&lt;rec&gt;();
      static rec record = new rec();
  
      public static void main(String[] args){
  
          vectorBuilder();
          recordBuilder();
          showElements();
  
      }
  
      public static void recordBuilder(){
  
          try{
              for(int i=0;i&lt;listElements.size();i++){
                  record.setId((String) listElements.elementAt(i));
                  record.setName((String) listName.elementAt(i));
                  record.setDate((String) listDate.elementAt(i));
                  record.setPrice(((Integer) listPrice.elementAt(i)).intValue());
                  record.setAbstract((String) listAbstract.elementAt(i));
                  a.addElement(record);   
              }
  
          }catch (Exception e){
              System.out.println("Record Builder Error: " + e.getMessage());
          }
      }
  
      public static void vectorBuilder(){
          //Ben
          listElements.addElement("1");
          listName.addElement("Ben");
          listPrice.addElement(502);
          listDate.addElement("2012-05-12");
          listAbstract.addElement("Ben is a Good Boy");
  
          //Kesha
          listElements.addElement("2");
          listName.addElement("Kesha");
          listPrice.addElement(367);
          listDate.addElement("2012-02-24");
          listAbstract.addElement("Kesha Works hard in her school work");
  
          //Catty
          listElements.addElement("3");
          listName.addElement("Catty");
          listPrice.addElement(100);
          listDate.addElement("2012-01-04");
          listAbstract.addElement("Catty is a preety girl");
  
  
      }
  
      public static void showElements(){
          for(int i=0;i&lt;a.size();i++)
          {
              rec r = (rec) a.elementAt(i);
              System.out.println("ID:"+r.getId()+" and Name:"+r.getName()+" and Price:"+r.getPrice()+" and Msg:"+r.getAbstract());
          }
  
      }
  }
  </code></pre>
  
  <p>Here is the <strong>rec.java</strong></p>
  
  <pre><code>package testing;
  
  
  public class rec {
          String name;
          String id;
          String date;
          String strAbstract;
          int price;
  
  
          public String getName() {
              return name;
          }
          public void setName(String name) {
              this.name = name;
          }
          public String getId() {
              return id;
          }
          public void setId(String id) {
              this.id = id;
          }
  
          public String getDate() {
              return date;
          }
          public void setDate(String date) {
              this.date = date;
          }
  
          public String getAbstract() {
              return strAbstract;
          }
          public void setAbstract(String strAbstract) {
              this.strAbstract = strAbstract;
          }
  
          public int getPrice() {
              return price;
          }
          public void setPrice(int price) {
              this.price = price;
          }
  
  
  }
  </code></pre>