Here you can find the source of asList(String... strings)
List<String>
Parameter | Description |
---|---|
strings | the variable number of Strings to be converted to a list. |
public static List<String> asList(String... strings)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.ArrayList; import java.util.List; public class Main { /**//w ww . ja va 2s. c om * Returns from a variable number of String parameters a <code>List<String></code> * * @param strings the variable number of Strings to be converted to a list. * @return the list of strings. */ public static List<String> asList(String... strings) { List<String> listOfStrings = new ArrayList<>(strings.length); for (int i = 0; i < strings.length; i++) { listOfStrings.add(strings[i]); } return listOfStrings; } }