title: Java Convert Object[] Array to Vector
body: <p>What's the best way to convert an Object array to a Vector?</p>
  
  <p>JDE &lt; 1.5</p>
  
  <pre><code>public Vector getListElements()
  {
    Vector myVector = this.elements;
    return myVector;
  }
  </code></pre>
  
  <p>this.elements is an Object[]</p>
  
  <p>Thanks,
  rAyt</p>
  
  <p><strong>I should clarify my question</strong></p>
  
  <p>My target platform is a blackberry.</p>
  
  <p>Collections aren't supported. Array.asList() isn't, either :/</p>
  
  <p>Full Class</p>
  
  <pre><code>package CustomElements;
  
  import net.rim.device.api.ui.component .*;
  import net.rim.device.api.collection.util.*; 
  import net.rim.device.api.util.*;
  import java.util.*;
  
  public class ContactsList extends SortedReadableList implements KeywordProvider
  {
      // Constructor
      public ContactsList(Vector contacts)
      {
          super(new ContactsListComparatorByFirstName());    
          loadFrom(contacts.elements());      
      }
      // Add Element to ContactsSortedReadableList
      void addElement(Object element)
      {
          doAdd(element); 
      }   
  
      public Vector getListElements()
      {
          return new Vector(Collection
  
  
          Vector test = this.getElements();
      }
      // getKeywords
      public String[] getKeywords(Object element) 
      {
          return StringUtilities.stringToWords(((Contact)element).get_contactFirstName());
          // return StringUtilities.stringToWords(element.toString());
      }  
      //  Comparator sorting Contact objects by name
      final static class ContactsListComparatorByFirstName implements Comparator
      {                           
          public int compare(Object o1, Object o2)
          {
              // Sticky Entries Implementation
              if(((ContactsListObject)o2).getSticky())
              {
                  return 1;
              } else
                  if (((ContactsListObject)o1).getSticky())
                  {
                      return -1;
                  } else
                  {
                      if(((ContactsListObject)o1).get_contactFirstName().compareTo(((ContactsListObject)o2).get_contactFirstName()) &lt;0)
                      {
                          return -1;
                      }
                      if(((ContactsListObject)o1).get_contactFirstName().compareTo(((ContactsListObject)o2).get_contactFirstName()) &gt;0)
                      {
                          return 1;
                      }
                      else
                      {
                          return 0;
                      }
                  }
          }        
      }    
  }
  </code></pre>