Question from the Java and Craftsmanship test

Write a Java code that returns the integer 51

Medium

This code

Optional.of("42")
  .map(Integer::parseInt)
  .map(value -> value * 2)
  .filter(value -> value < 50)
  .orElseGet(() -> 51)
Author: Clément DevosStatus: PublishedQuestion passed 343 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!