This is one question. TA An ArrayListofIntegertypeobectsis called i List Write a
ID: 3881879 • Letter: T
Question
This is one question. TA An ArrayListofIntegertypeobectsis called i List Write an initialization statement for it Write Java code to calculate the sum of all elements in it. (Hint Use a. for-each loop) - Suppose the contentof iList is Integer objects of values 1 .6 14 22.. 29 16 3950 27 3335 28 Start with the original list What is the result if Collections.sortülist), is Start with the original list Are the results of following the same? What the list will be if Collections.reverseüList), is executed? executed? List) And Collections.sortüList) Collections.reverseilist) B. A list object wlist contains the words, in the order it is shown, this is not the droid you are looking for Give the final content, and provide the You are going to trace the content of lists print out ArrayListExplanation / Answer
1A
Collections.reverse(iList) will reverse the list.
No, the 2 are not the same.
Collections.reverse(iList);
Collections.sort(iList);
This sorts the list in ascending order.
Collections.sort(iList);
Collections.reverse(iList);
This sorts the list in descending order.
B
result After first sort : are droid for is looking not the this you
result after second sort : are droid for is looking not the this you is are for not the you this droid looking
Final result : are droid for is looking not you is are for not you this droid looking
Print out : are droid for is looking not you is are for not you this droid looking
C.
spade A spade 5 heart A diamond 5 club J
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.