# Converting Future to CompletableFuture With Java Virtual Threads

DevFeed: [Converting Future to CompletableFuture With Java Virtual Threads](<https://devfeed.tech/articles/converting-future-to-completablefuture-with-java-virtual-threads-18821.md>)

Original publisher: [Read original article](<https://www.morling.dev/blog/future-to-completablefuture-with-java-virtual-threads/>)

Published: 2025-07-17T08:25:00Z

Content type: tutorial

Language: en

Sources: [Gunnar Morling](<https://devfeed.tech/sources/gunnar-morling.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [blocking](<https://devfeed.tech/tags/blocking.md>), [java](<https://devfeed.tech/tags/java.md>), [java-8](<https://devfeed.tech/tags/java-8.md>), [threads](<https://devfeed.tech/tags/threads.md>)

## AI overview

This tutorial explains how Java 21+ virtual threads can help convert legacy Future objects into CompletableFuture instances. It contrasts blocking, polling, and asynchronous approaches, noting that virtual threads make blocking inexpensive by unmounting blocked threads from their underlying platform threads.

## Source excerpt

This post explores how virtual threads in Java 21+ provide an elegant solution for converting legacy Future objects into CompletableFuture instances. Since Java 8, the CompletableFuture API provides a convenient way for performing asynchronous operations in a functional, composable way. This makes it very simple to call some long-running methods--for instance involving external I/O--asynchronously and process each result as soon as it is available, without blocking on any threads: