Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

229
Vistas
How do I set result of java.util.concurrent.Future?

The Future interface doesn't provide a method for setting the result. In the docs, they say,

A Future represents the result of an asynchronous computation. Methods are provided to check if the computation is complete, to wait for its completion, and to retrieve the result of the computation.

But I don't understand how do I set the result in the first place?

I was comparing Future to DeferredResult from Spring and they both basically represent the result of Async computation but DeferredResult has method for setting the result and Future doesn't?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

If you don't want to create your own class implementing Future and providing a setter (or extending FutureTask and making the setter public), you can use the ready-made CompletableFuture. It allows you to set the values, as well as a lot of other tricks that the Future interface doesn't show.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda