I need a to create collection constructor. This is a constructor copies all of its elements from my array into the new TimeArrayList.
My constructor looks like this so far
private E[] timeData;
private int capacity = 0;
public TimeArrayList(Collection<? extends E> c) {
timeData = (E[]) new Object[capacity];
for (int i = 0; i < timeData.length; i++) {
//this is where im having the problem
}
}
I do not know how to get the values from my array and create an Array List. I think I also have to put in an iterator somewhere also.