Exam (elaborations) java Collections, Maps and Iterators
1. Give the definition of a boolean valued static generic method named inSome . The method inSome has two parameters of type Collection<T> and one parameter of type T . The method returns true if the parameter of type T is in either (or both) collections; it returns false otherwise. 2. Give the definition of a static generic method named getFirst that has one parameter of type List<T> and a return type of T . The method returns the first element in the list or null if the list is empty.
Connected book
Written for
Document information
- Uploaded on
- February 7, 2023
- Number of pages
- 4
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
Also available in package deal