20161018 Problem Resolution Please click on the "Java Daily topic" 20161019 "below today's question.
PackageOct2016; Importjava.util.List; Public classQues1019 {//Sum of arrays Public Static intSumint[] datas) { intsum = 0; for(inti=0; i<datas.length;i++) {sum+ = Datas[i];//1 } returnsum; } //Sum the list Public Static intSUM (list<integer>datas) { intsum = 0; for(inti=0; I<datas.size (); i++) {sum+ = Datas.get (i);//2 } returnsum; } }
Today's question:
The above two sums of arrays (collections) of int type, which is better performance analysis? (Click on the "Java Daily question" 20161019 "to view the 20161018 problem resolution)
Title Originally published in the public number, Pinterest: "Java daily problem" 20161019, "Java daily" 20161019
Daily issue of the latest will be published in the public, welcome to subscribe, Exchange progress
Java daily topic 20161019