Skip to content
CodeKruPro

Method references and their lambdas

QuizEasy-MediumJava onlyAsked in: Tech Mahindra

Which pairs are equivalent? Pick all that apply.

  • Function<String, Integer> f = String::length; and s -> s.length()
  • Consumer<String> c = System.out::println; and s -> System.out.println(s)
  • Supplier<List<String>> s = ArrayList::new; and () -> new ArrayList<>()
  • Predicate<String> p = String::isEmpty; and s -> s.length() > 0

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in