Last active
September 30, 2020 01:13
-
-
Save granoeste/982563 to your computer and use it in GitHub Desktop.
[Java]Arrays.toString
配列とコレクションの変換
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
// 配列要素をカンマ区切の文字列に変換してくれる | |
Arrays.toString(配列要素) | |
// 指定された配列の「深層内容」の文字列表現を返す。 | |
Arrays.deepToString(Object[] a) | |
// 配列をListに変換 | |
List<String> list = Arrays.asList(strs); | |
//ListからStringの配列に変換 | |
String[] strs = (String[])l.toArray(new String[0]); | |
// ListからIntegerの配列に変換 | |
Integer[] integers = (Integer[])l.toArray(new Integer[0]); | |
// Integerの配列からプリミティブのintの配列に変換 | |
int[] i = org.apache.commons.lang.ArrayUtils.toPrimitive(integers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment