List of utility methods to do List Create
ArrayList | createIntListToN(int n) createIntListToN: creates an ArrayList of n integers from 0 to n-1 useful to create a list for considering all the values of the rows or columns of the alignment matrix Takes O(n) ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < n; i++) { list.add(i); return list; |
HashMap | createKeyValPair(List create Key Val Pair HashMap<Long, T> ret = new HashMap<Long, T>(); Long rand; for (T t : lst) { rand = Math.round(Math.random() * 1000000); ret.put(rand, t); return ret; |
void | createLimitSql(StringBuilder sql, Integer startNum, Integer rowNum, List create Limit Sql if (null != startNum && null != rowNum) { sql.append(" LIMIT ?,?"); params.add(startNum); params.add(rowNum); } else if (null != rowNum) { sql.append(" LIMIT ?"); params.add(rowNum); |
List | createList(Iterator iterator) create List List list = new ArrayList(); while (iterator.hasNext()) list.add(iterator.next()); return list; |
List | createList() create List return new ArrayList<>(); |
List | createList(Class Uses java generics to create a new ArrayList that can contain elements of the specified elementClass. return new ArrayList<T>(); |
List | createList(Class Creates the list. List<T> returnList = new ArrayList<T>(); for (T item : items) { returnList.add(item); return returnList; |
List | createList(Collection collection) create List return new ArrayList(collection); |
List | createList(Collection collection) Creates a new list from the given collection. if (collection instanceof List) { return (List) collection; List list = new ArrayList(); Iterator it = collection.iterator(); while (it.hasNext()) { list.add(it.next()); return list; |
List | createList(Collection Returns a List implementation for any input collection return Collections.list(Collections.enumeration(collection));
|