Posted By

nialace on 10/13/11


Tagged

java array


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

bobgott


List to Array , Array to List


 / Published in: Java
 

URL: http://www.developpez.net/forums/d589614/java/general-java/langage/initialisation-list-proche-tableaux/

  1. /*array to list*/
  2. String[] tempArray = new String[]{"edit","choice","check","radio"};
  3.  
  4. //attention la liste retournée est de taille limité
  5. List<String> list = Arrays.asList(tempArray);
  6.  
  7. //pour une liste sans limite
  8. List<String> list2 = new ArrayList<String>(Arrays.asList("a", "b", "c"));
  9.  
  10.  
  11. /*list to array*/
  12. String[] argsEditField = list.toArray(new String[0]);

Report this snippet  

You need to login to post a comment.