Research for API document of class ArrayList. a) What is the method signature of
ID: 3694384 • Letter: R
Question
Research for API document of class ArrayList. a) What is the method signature of method contains? (return type and parameters) b) What is the method signature of method size? (return type and parameters) c) Describe the usage of set method 3. Write the following code to initialize ArrayList objects a) deck, an (empty) ArrayList of Card objects b) wordlist, an ArrayList of String objects c) i_list, an ArrayList of integers 4. Read Java code (of CarFrame program), answer following questions: About Array a) Where a field of an array is initialized? What type of array is it? What is its size? b) Where the array you found in d) is used? Find some of its usages. c) In the constructor, there is a for loop. How many times does it execute? Which variable is the index? About ArrayList d) Where an ArrayList is initialized? What type of list is that? e) Where the list object you found in a) is used? Find ALL its usages. f) Which methods are called on the list object you found in a)? [There are three different method calls on it.]Explanation / Answer
2.
a)
Parameters
The element whose presence in this list is to be tested.
Return Value
This method returns true if this list contains the specified element.
b)
Declaration
Following is the declaration for java.util.ArrayList.size() method
Parameters
NA
Return Value
This method returns the number of elements in this list.
c)Object set(int index, Object element)
Replaces the element at the specified position in this list with the specified element. Throws IndexOutOfBoundsException if the specified index is is out of range (index < 0 || index >= size()).
3.
a)ArrayList<Card>deck=new ArrayList<Card>();
b)ArrayList<String>wordlist=new ArrayList<String>();
c)ArrayList<Integer>deck=new ArrayList<Integer>();
4) please provide the code or URL of the CarFrame program
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.