Below code grabbed from google io open source.
com.google.android.apps.iosched.util.Lists.java http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/Lists.java
public static <E> ArrayList<E> newArrayList(E... elements) {
int capacity = (elements.length * 110) / 100 + 5;
ArrayList<E> list = new ArrayList<E>(capacity);
Collections.addAll(list, elements);
return list;
}
com.google.android.apps.iosched.util.Sets.java http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/Sets.java
public static <E> HashSet<E> newHashSet(E... elements) {
int capacity = elements.length * 4 / 3 + 1;
HashSet<E> set = new HashSet<E>(capacity);
Collections.addAll(set, elements);
return set;
}
What is the capacity variable supposed to mean? Thanks in advance!