ArrayList setSize() not there (ensureCapacity() does not work here)
Hi All,
I am in a middle of a project and i discover that arraylist does not have any method similar to vector setSize(). Is this a bug, however i tried to use an alternative but this is throwing me an Error.Please Help.
import java.util.*;
class Demo
{
publicstaticvoid main(String[] args)
{
List <String>listOfCar;
listOfCar=new ArrayList<String>();
listOfCar.ensureCapacity(5);
}
}
and the Error Message is...
C:\program1\java_programs>javac Demo.java
Demo.java:9: cannot find symbol
symbol : method ensureCapacity(int)
location:interface java.util.List<java.lang.String>
listOfCar.ensureCapacity(5);
^
1 error

