I find that I can do almost anything easily and with more control using ArrayListthan with the array in my daily coding. So I ask:
ArrayList
, . JVM. arrays , List. array, , . , List , . generics. covariant Generics invariant, Arrays and Generics don't mix, Joshua Bloch List over array Effective Java II 25. List, .
JVM
arrays
List
array
generics
covariant
invariant
Arrays and Generics don't mix
Joshua Bloch
Effective Java II
Array ArrayList , . , ArrayList, , , ArrayList. , , ArrayList, , , , , .
, , List over Array . - . , List , (ArrayList, LinkedList ..), , .
, , , , Java.
, - :
List<T> list = foo.getList();
getList() ArrayList, , LinkedList, , , , , , - .
, List .
, . " Big-O". , , yourList.toArray(yourArray). , Arrays (Arrays.asList(yourArray)). List , , , , , .
yourList.toArray(yourArray)
Arrays
Arrays.asList(yourArray)
-, , ( ).
, , - . , . (, 100 ) 1 , , () 100 . , , ; .
ArrayList , , , Arraylist. , ArrayList , , , , , , ArrayList .
Source: https://habr.com/ru/post/1568791/More articles:Code execution error in html style attribute - c #Amazon Web Services: setting S3 policies to allow putObject and getObject, but deny listBucket - securityUsing SqlCommandProvider with a custom timeout - sqlAndroid Flurry ad not showing - androidWhy is Long unable to accept a 12-digit value, even if I explicitly declared it? - javaArraylist and arrays - javaFPU Instructions That Verify Accuracy - x86Why std :: unary_function does not contain a virtual destructor - c ++Django and AJAX: remove multiple checkbox elements - checkboxHow to manage toastr parameters (or set them around the world) using a controller or Angular module - angularjsAll Articles