fr

Daily Challenge 🗓️

Your daily dose of technical intelligence to shine in (developer) society.

Discover a software development quiz per day with its detailed correction.

Frontend, Backend, Mobile, Data, Web, AI, Infra... Everything that can be coded!

Friday 16 January 2026

-

Java and Craftsmanship

Java and Craftsmanship #22/24

This code

public final class StringCalculator {

  private static final String SEPARATOR = ",|\n";

  private StringCalculator() {}

  public static String sum(String numbers) {
    if (noNumbers(numbers)) {
      return "0";
    }

    return Arrays.stream(numbers.split(SEPARATOR))
        .map(BigDecimal::new)
        .reduce(BigDecimal.ZERO, BigDecimal::add)
        .toPlainString();
  }

  private static boolean noNumbers(String numbers) {
    return numbers == null || numbers.isBlank();
  }
}
Author: W3D TeamStatus: PublishedQuestion passed 179 times
-1
Reviews from developers
developer avatar
Other
Auteur anonyme
16/01/2026
Teste-t-on ici la capacité du candidat à comprendre du code ou à connaitre les événements communautaires?

About Daily Challenge 🗓️

From Monday to Friday, discover each day a quiz question with its detailed answer to enrich your tech knowledge. The questions are proposed by the WeLoveDevs.com community: experienced developers, trainers and freelancers.WeLoveDevs.com helps developers to find their dream job. We also provide over 50 free technical tests in different technologies for those of you who would like to test your knowledge.

History

    ⚠️
    Your browser is badly|not supported!
    We recommend you to use a more modern browser such as Edge, Chrome or Firefox
    Know More