Top Posters
Since Sunday
a
5
k
5
c
5
B
5
l
5
C
4
s
4
a
4
t
4
i
4
r
4
r
4
New Topic  
lizsmith lizsmith
wrote...
Posts: 486
3 years ago
Suppose list1 is an ArrayList and list2 is a LinkedList. Both contains 1 million double values. Analyze the following code:

A:
for (int i = 0; i < list1.size(); i++)
sum += list1.get(i);

B:
for (int i = 0; i < list2.size(); i++)
sum += list2.get(i);


▸ Code fragment A runs faster than code fragment B.

▸ Code fragment A runs as fast as code fragment B.

▸ Code fragment B runs faster than code fragment A.
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 51 times
1 Reply
Replies
Answer verified by a subject expert
ShayT0923ShayT0923
wrote...
Posts: 387
3 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here

Related Topics

lizsmith Author
wrote...

3 years ago
Good timing, thanks!
wrote...

Yesterday
Smart ... Thanks!
wrote...

2 hours ago
Brilliant
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1386 People Browsing
 131 Signed Up Today
Related Images
  
 533
  
 414
  
 224
Your Opinion
Which is the best fuel for late night cramming?
Votes: 145