Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: convert an object array to a collection

Java: convert an object array to a collection

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Generic_Meth
  // The method takes an array of objects and returns a list
  public static List convert_Tab(T[] tableau)
  	List list=new ArrayList();
  	return list;
  public static void main (String[] args)
  	   String [] tab_Str={"A", "B", "C"};
       List   mysList=convert_Tab(tab_Str);
       System.out.println (mysList);
       Integer [] tab_Int={1, 8, 16};
       System.out.println (Arrays.asList(mysList));

Users who found this page were searching for:

  • perl random value from array
  • tkinter pause animation
  • use of comma operator in for loop
  • python if while key press
  • how to time an operation in java

No comments yet.

Leave a Comment