Out position
An out position is a type-parameter usage position in which values of the parameterized type are produced or returned rather than consumed.
Kotlin in Action, 2E
An out position is a type-parameter usage position in which values of the parameterized type are produced rather than consumed.
- How it is used
- Constrains generic APIs to producer-only use so subtype relationships remain safe.
- How deep it goes
- Explains return and parameter positions, declaration-site restrictions, covariance, and collection examples without descending into runtime implementation.
- Examples
- Uses Producer, Herd<Cat>, Herd<Animal>, List, and MutableList to contrast producing values with consuming them.
- What you can do after
- Apply it via Kotlin's out modifier to design producer-like generic types with safe covariance.
Fabulous Adventures in Data Structures and Algorithms
An output position is a type-parameter occurrence where values of the parameterized type are produced or returned rather than consumed.
- How it is used
- Uses output positions to determine when generic interfaces can safely support covariance.
- How deep it goes
- Explains returned values, getters, consumed parameters, and an extension-method workaround, then connects them to type safety.
- Examples
- Uses IEnumerable<T>, IE<T>, an immutable stack, and Animal, Giraffe, and Tiger assignments.
- What you can do after
- Apply it via C# generic interfaces to recognize safe covariance and relocate consuming operations into extension methods.
Read how Fabulous Adventures in Data Structures and Algorithms explains out position →
Related concepts
- covarianceused by · Covariance is a type-system property in which subtyping of a type argument induces the same-direction subtyping relationship for its parameterized type.
- in positioncontrasts with · An in position is a type-parameter usage position in which values of the parameterized type are accepted or consumed rather than produced.
- out keywordconfigured by · The out keyword declares a Kotlin generic type parameter as covariant and restricts its use to out positions.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

