This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package org.yacos.web.PCmember.form;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AutoInitArrayList < T > extends ArrayList < T > {
|
||||
private static final long serialVersionUID = 1L ;
|
||||
|
||||
private Class < T > t = null ;
|
||||
|
||||
public AutoInitArrayList(Class < T > t) {
|
||||
this .t = t;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get( int index) {
|
||||
try {
|
||||
while (index >= size()) {
|
||||
add(t.newInstance());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return super.get(index);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user