following line of code converts an array into a list.
List list = Arrays.asList(str); // str is an array
Following program converts an array of strings into a List.
package com.blog.javaexposure.util;
import java.util.Arrays;
import java.util.List;
public class Array2List {
public static void main(String rags[]){
// Creating a string array
String[] str = {"One","Two","Three","Four","Five"};
// Convert array to List
List
}
No comments:
Post a Comment