title: Jetpack Compose @Stable List<T> parameter recomposition
body: <p>@Composable functions are recomposed</p>
  <ul>
  <li>if one the parameters is changed or</li>
  <li>if one of the parameters is not @Stable/@Immutable</li>
  </ul>
  <p>When passing <code>items: List&lt;Int&gt;</code> as parameter, compose always recomposes, regardless of <code>List</code> is immutable and cannot be changed. (<em>List is interface without @Stable annotation</em>). So any Composable function which accepts <code>List&lt;T&gt;</code> as parameter always gets recomposed, no intelligent recomposition.</p>
  <p>How to mark <code>List&lt;T&gt;</code> as stable, so compiler knows that List is immutable and function never needs recomposition because of it?</p>
  <p>Only way i found is wrapping like <code>@Immutable data class ImmutableList&lt;T&gt;(val items: List&lt;T&gt;)</code>. Demo <em>(when Child1 recomposes Parent, Child2 with same List gets recomposed too)</em>:</p>
  <pre><code>class TestActivity : AppCompatActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContent {
              ComposeBasicsTheme {
                  Parent()
              }
          }
      }
  }
  
  @Composable
  fun Parent() {
      Log.d(&quot;Test&quot;, &quot;Parent Draw&quot;)
      val state = remember { mutableStateOf(false) }
      val items = remember { listOf(1, 2, 3) }
  
      Column {
          // click forces recomposition of Parent
          Child1(value = state.value,
              onClick = { state.value = !state.value })
  
          //
          Child2(items)
      }
  }
  
  @Composable
  fun Child1(
      value: Boolean,
      onClick: () -&gt; Unit
  ) {
      Log.d(&quot;Test&quot;, &quot;Child1 Draw&quot;)
      Text(
          &quot;Child1 ($value): Click to recompose Parent&quot;,
          modifier = Modifier
              .clickable { onClick() }
              .padding(8.dp)
      )
  }
  
  @Composable
  fun Child2(items: List&lt;Int&gt;) {
      Log.d(&quot;Test&quot;, &quot;Child2 Draw&quot;)
      Text(
          &quot;Child 2 (${items.size})&quot;,
          modifier = Modifier
              .padding(8.dp)
      )
  }
  </code></pre>