<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Kotlin on Subhadip's Blog</title><link>https://www.subhadig.net/tags/kotlin/</link><description>Recent content in Kotlin on Subhadip's Blog</description><generator>Hugo</generator><language>en-us</language><copyright>Subhadip Ghosh</copyright><lastBuildDate>Mon, 25 Jul 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://www.subhadig.net/tags/kotlin/index.xml" rel="self" type="application/rss+xml"/><item><title>Understanding Kotlin Covariance and Contravariance</title><link>https://www.subhadig.net/posts/understanding-kotlin-covariance-and-contravariance/</link><pubDate>Mon, 25 Jul 2022 00:00:00 +0000</pubDate><guid>https://www.subhadig.net/posts/understanding-kotlin-covariance-and-contravariance/</guid><description>&lt;h1 id="1--introduction"&gt;1. Introduction&lt;/h1&gt;
&lt;p&gt;To someone coming from the Java world to the world of Kotlin, the concepts of
Covariance and Contravariance can be somewhat overwhelming to grab at first.
But they don&amp;rsquo;t have to be once you start understanding the basic cadence of it.
This article is going to be a step by step depiction of how I have come to
understand these two topics.&lt;/p&gt;
&lt;h1 id="2--lets-create-some-classes"&gt;2. Let&amp;rsquo;s create some classes!&lt;/h1&gt;
&lt;p&gt;First let&amp;rsquo;s create a small class hierarchy that we can use to understand these
concepts.
&lt;code&gt;Paper&lt;/code&gt; is the parent class of the &lt;code&gt;Regular&lt;/code&gt; paper and the &lt;code&gt;Premium&lt;/code&gt; paper.&lt;/p&gt;</description></item></channel></rss>