title: How to add objects in a List to a Vector?
body: <p>I'm dealing with legacy code right here. I can't paste the code so I will give an example.</p>
  <pre><code>List list1 = &lt;Objects returned from SQL SELECT results&gt;
  </code></pre>
  <p>So basically list1 contains a number of objects. I've tested it was indeed there as I was using getters to confirm that there are objects in the list. Let's say there are a total of 3 objects.</p>
  <p>I'm currently doing:</p>
  <pre><code>Vector vector1;
  
  for (int i = 0; i &lt; list1.size(); i++) {
      vector1.add(list1.get(i));
  }
  </code></pre>
  <p>But it does not work. How do I transfer objects from List to Vector?</p>
  <p>Note that I cannot change the data type and it has to be List and Vector, I've tried adding casting to individual objects as well, and I have tested using <code>vector1.addElement()</code> as well, but neither works.</p>
  <p>P:S: Java EE IDE Web Developer in Eclipse v4.6. My console doesn't write anything, and my front end just &quot;pops&quot; an error, that is why I'm confused as well. Apologies if I do not have enough information, just wanted to make sure that my method to transfer objects from List to Vector is correct.</p>