Here you can find the source of resize(List
public static <V> void resize(List<V> list, int size)
//package com.java2s; /*/*from w w w . jav a2 s . c o m*/ * Copyright (C) 2009 Emweb bvba, Leuven, Belgium. * * See the LICENSE file for terms of use. */ import java.util.List; public class Main { public static <V> void resize(List<V> list, int size) { while (list.size() > size) list.remove(list.size() - 1); while (list.size() < size) list.add(null); } public static <V> boolean add(List<V> list, V v) { if (list.indexOf(v) == -1) { list.add(v); return true; } else return false; } }