Section 20.5 Check Point Questions5 questions
20.5.1
How do you add and remove elements from a list? How do you traverse a list in both directions?
20.5.2
Suppose that list1 is a list that contains the strings red, yellow, and green, and that list2 is another list that contains the strings red, yellow, and blue. Answer the following questions:
a. What are list1 and list2 after executing list1.addAll(list2)?
b. What are list1 and list2 after executing list1.add(list2)?
c. What are list1 and list2 after executing list1.removeAll(list2)?
d. What are list1 and list2 after executing list1.remove(list2)?
e. What are list1 and list2 after executing list1.retainAll(list2)?
f. What is list1 after executing list1.clear()?
a. What are list1 and list2 after executing list1.addAll(list2)?
b. What are list1 and list2 after executing list1.add(list2)?
c. What are list1 and list2 after executing list1.removeAll(list2)?
d. What are list1 and list2 after executing list1.remove(list2)?
e. What are list1 and list2 after executing list1.retainAll(list2)?
f. What is list1 after executing list1.clear()?
20.5.3
What are the differences between ArrayList and LinkedList? Which list should you use to insert and delete elements at the beginning of a list?
20.5.4
Are all the methods in ArrayList also in LinkedList? What methods are in LinkedList but not in ArrayList?
20.5.5
How do you create a list from an array of objects?