Last active
November 28, 2021 13:02
-
-
Save XDo0/1a5dce773fb847249b876220d59b5818 to your computer and use it in GitHub Desktop.
Java Type Conversion
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
//string 2 list | |
List<String> l=Arrays.asList(s.split("")); | |
// array 2 list(except 8 basic types),reference type | |
List<T> l=Arrays.asList(array); | |
//8 basic types arrays 2 list, such as Integer | |
List list=new ArrayList(); | |
double array[]={12,223,234}; | |
for(int i=0;i<array.length;i++){ | |
list.add(new Double(array[i])); | |
} | |
//list 2 array | |
int size =list.size(); | |
String array[]=(String[])list.toArray(new String [size]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment