Created
April 24, 2015 09:55
-
-
Save toagit/ad8357e1c4bf3e4c0032 to your computer and use it in GitHub Desktop.
配列<=>List変換
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Array => List | |
// 一次元次配列 | |
List<String> listA = Arrays.asList(new String[] {"ichika","kaito","kanna","tetsurou","mio","remmon"}); | |
ArrayList<String> aListA = new ArrayList<String>(list); | |
for (String str : aList) { | |
System.print.out(str); | |
} | |
// 多次元配列 | |
List<String[]> listB = Arrays.asList(new String[][] {{"ichika","kaito","kanna","tetsurou","mio","remmon"}}); | |
ArrayList<String[]> aListB = new ArrayList<String[]>(list); | |
// List => Array | |
String[] strArray = (Sring[])listA.toArray(new String[listA.size]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment