Here you can find the source of asListFromObjectArray(Object[] at)
Parameter | Description |
---|---|
at | a parameter |
public static <T> List<T> asListFromObjectArray(Object[] at)
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { /**/* w ww . jav a 2s . c om*/ * @param at * @return a List containing the elements of the given array. * @precondition at != null * @postcondition result != null * @postcondition result.size() == at.length */ public static <T> List<T> asListFromObjectArray(Object[] at) { final List<T> result = new ArrayList<T>(at.length); for (Object t : at) { result.add((T) t); } assert result.size() == at.length; return result; } /** * @param coll * @postcondition (coll == null) --> (result == 0) * @postcondition (coll != null) --> (result == coll.size()) */ public static int size(Collection<?> coll) { return (coll == null) ? 0 : coll.size(); } }