Here you can find the source of listOfOne()
public static <T> ArrayList<T> listOfOne()
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 Google, Inc.//w w w . ja v a2 s .c o m * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Google, Inc. - initial API and implementation *******************************************************************************/ import java.util.ArrayList; public class Main { /** * Create an array list of the given type of size 1. */ public static <T> ArrayList<T> listOfOne() { return new ArrayList<T>(1); } }