Here you can find the source of createDefaultValueList(int capacity, T defaultValue)
Parameter | Description |
---|---|
T | a parameter |
capacity | a parameter |
defaultValue | a parameter |
public final static <T> List<T> createDefaultValueList(int capacity, T defaultValue)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { /**/*from ww w. j av a 2 s .c om*/ * creates a list containing the defaultValue as each entry. * * @param <T> * @param capacity * @param defaultValue * @return */ public final static <T> List<T> createDefaultValueList(int capacity, T defaultValue) { List<T> list = new ArrayList<T>(capacity); for (int i = 0; i < capacity; i++) { list.add(defaultValue); } return list; } }