--- title: Why we generate separate Kotlin and Java SDKs | Stainless description: Kotlin is interoperable with Java, but one SDK for both languages doesn't work in practice. --- Although the Java SDK is written in Kotlin, which is [interoperable with Java](https://kotlinlang.org/docs/java-to-kotlin-interop.html), its public API differs from the Kotlin SDK’s. Here are some examples: - OpenAPI nullable schemas are exposed as [`Optional` types](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html) for Java and [nullable types](https://kotlinlang.org/docs/null-safety.html) for Kotlin - Lazy iterables are exposed as [`Stream` types](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html) for Java and [`Sequence` types](https://kotlinlang.org/docs/sequences.html) for Kotlin - Async operations are exposed using [`CompletableFuture` types](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html) for Java and [`suspend` functions](https://kotlinlang.org/docs/coroutines-overview.html#suspending-functions-and-coroutine-builders) for Kotlin The Java SDK is written in Kotlin because it simplifies code sharing between the Java and Kotlin SDKs, including [custom code](/docs/sdks/configure/custom-code/index.md). To add custom Java code, create a `java/` directory alongside the existing `kotlin/` directory. The [Kotlin documentation on Java interoperability](https://kotlinlang.org/docs/java-interop.html) has guidance and examples you can reference to ensure your Java code works with the Kotlin code we generate.