Take the first count
elements.
int ct = getCount();
if (ct < 0) {
throw new BuildException(BAD_COUNT);
}
Iterator iter = getResourceCollection().iterator();
ArrayList al = new ArrayList(ct);
for (int i = 0; i < ct && iter.hasNext(); i++) {
al.add(iter.next());
}
return al;