List of utility methods to do List Create
List | createListFromList(Collection create List From List List<T> newList = new ArrayList<T>(); if (collection != null) { newList.addAll(collection); return newList; |
List | createListOfObjects(T... elements) create List Of Objects ArrayList<T> list = new ArrayList<T>(elements.length); for (T element : elements) { list.add(element); return list; |
List | createListOfOneItem(Object item) create List Of One Item List list = new ArrayList(); list.add(item); return list; |
List | createListOfValidNumberOfPoints(int[] terms, int min, int max) create List Of Valid Number Of Points List<Integer> list = new ArrayList<Integer>(); createListOfValidNumberOfPoints(list, 0, terms, min, max); Collections.sort(list); return list; |
List | createListWithArray(Object[] array) Create a new array list with input array. final ArrayList<Object> result = new ArrayList<Object>(); if (array == null) { return result; for (Object obj : array) { result.add(obj); return result; ... |
ArrayList | createListWithObjects(Object... objects) create List With Objects ArrayList<Object> list = new ArrayList<Object>(); list.addAll(Arrays.asList(objects)); return list; |
HashMap | createMapFromList(List list) Simple List to HashMap creator HashMap hmap = new HashMap(list.size()); Iterator iter = list.iterator(); while (iter.hasNext()) { Object oTemp = iter.next(); hmap.put(oTemp, oTemp); return hmap; |
Map | createMapOfObjects(List create Map Of Objects HashMap<K, V> map = new HashMap<K, V>(keys.size()); if (keys.size() == values.size()) { Iterator<K> keysIterator = keys.iterator(); Iterator<V> valuesIterator = values.iterator(); while (keysIterator.hasNext() && valuesIterator.hasNext()) { K key = keysIterator.next(); V value = valuesIterator.next(); map.put(key, value); ... |
int[][] | createMatrix(List Create matrix for the compare algorithms. int M = source.size(); int N = target.size(); int[][] result = new int[M + 1][N + 1]; for (int i = M - 1; i >= 0; i--) { for (int j = N - 1; j >= 0; j--) { if (source.get(i).equals(target.get(j))) { result[i][j] = result[i + 1][j + 1] + 1; } else { ... |
String | createMergedRegex(List create Merged Regex if (regexes == null) { return null; StringBuilder mergedRegexStringBuilder = new StringBuilder(""); int regexCount = regexes.size(); mergedRegexStringBuilder.append("("); for (int i = 0; i < regexCount; i++) { if ((i + 1) < regexCount) { ... |