# MutableList vs List

**URL:** <https://discuss.kotlinlang.org/t/mutablelist-vs-list/3459>\
**Category:** Support\
**Created:** [June 22, 2017, 4:56pm UTC](https://discuss.kotlinlang.org/t/mutablelist-vs-list/3459 "2017-06-22T16:56:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tieskedh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/tieskedh/32/2816_2.png) [@tieskedh](https://discuss.kotlinlang.org/u/tieskedh)\
**Post date:** [June 22, 2017, 4:56pm UTC](https://discuss.kotlinlang.org/t/mutablelist-vs-list/3459/1 "2017-06-22T16:56:52Z")

</div>

I was looking into the problem of SingletonList.

> **problem of SingletonList**
>
> ```
> val a = listOf("")
> if(a is MutableList){
> a.add("ded")
> }
> 
> ```
> 
> throws `UnSupportedOperationException`.

The SingletonList is immutable, so it should not implement `MutableList`.

When I did this, i came across the following quote on [https://youtrack.jetbrains.com/issue/KT-15126#tab=Comments:](https://youtrack.jetbrains.com/issue/KT-15126#tab=Comments:)

> The distinction between List and MutableList exists only at compile time. At runtime they become the same type.

Is it possible to add a interface in Java which a collection can implement at runtime to keep this information or can be added in a Java project to support this?

---

<div class="post-metadata">

**Author:** ![yole](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/yole/32/1425_2.png) [@yole](https://discuss.kotlinlang.org/u/yole)\
**Post date:** [June 22, 2017, 6:34pm UTC](https://discuss.kotlinlang.org/t/mutablelist-vs-list/3459/2 "2017-06-22T18:34:35Z")

</div>

Most Kotlin programs use regular Java collection classes, which are part of the JDK and do not implement any Kotlin-specific interfaces. Therefore, it’s not clear how it would be useful to define such an additional interface.
