1Z0-809 practice question 23 of 25
Which statement is true about the single abstract method of the java.util.function.Function interface?
Full set: 196 questionsThe java.util.function.Function interface is a generic functional interface. Its single abstract method is R apply(T t). This method takes one argument of generic type T and produces a result of generic type R. The types T and R can be different, allowing the function to transform an object of one type into an object of any other data type. For example, a Function could take a String and return its length as an Integer.
A. A functional interface that accepts one argument and returns void is a Consumer.
B. A functional interface that accepts one argument and returns a boolean is a Predicate.
C. A function that accepts and returns the same type is a UnaryOperator, which is a specific sub-interface of Function.
- Oracle, Java SE 8 Documentation, java.util.function.Function. The official API documentation specifies the abstract method as R apply(T t).
- Oracle, The Java™ Tutorials, "Standard Functional Interfaces". This tutorial describes the purpose and signature of the Function interface and contrasts it with other interfaces like Predicate and Consumer.
Keep practicing
Take the free 1Z0-809 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 1Z0-809 practice questions
- Question 2Given: class Student { String course, name, city; public Student (String name, String cou…
- Question 3Given: class Worker extends Thread { CyclicBarrier cb; public Worker(CyclicBarrier cb) { …
- Question 4Given the code fragment: Path file = Paths.get (“courses.txt”); // line n1 Assume the cou…
- Question 5Given that /green.txt and /colors/yellow.txt are accessible, and the code fragment: Path …
- Question 6Given the code fragment:List<String> empDetails = Arrays.asList(“100, Robin, HR”,“200, Ma…
- Question 7Given the code fragment: List str = Arrays.asList (“my”, “pen”, “is”, “your’, “pen”); Pre…
