# How can java.util.ArrayList inherit from MutableList

**URL:** <https://discuss.kotlinlang.org/t/how-can-java-util-arraylist-inherit-from-mutablelist/6146>\
**Category:** Language Design\
**Created:** [January 8, 2018, 6:32pm UTC](https://discuss.kotlinlang.org/t/how-can-java-util-arraylist-inherit-from-mutablelist/6146 "2018-01-08T18:32:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoymoyroy](https://avatars.discourse-cdn.com/v4/letter/y/eada6e/32.png) [@yoymoyroy](https://discuss.kotlinlang.org/u/yoymoyroy)\
**Post date:** [January 8, 2018, 6:32pm UTC](https://discuss.kotlinlang.org/t/how-can-java-util-arraylist-inherit-from-mutablelist/6146/1 "2018-01-08T18:32:38Z")

</div>

hi i try to understand some Konzepts about Kotlin.  
when i was looking at the collections at [kotlin.collections - Kotlin Programming Language](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/)

that ArrayList or HashMap have The JS Tag for the Javascript Plattform on it. Which I understand means its only used when targetting Javascript. In Intelij when I am doing a Java Project and add Kotlin support for JVM, I can still freely use kotlin.ArrayList. I saw that in TypeAlias.kt since Kotlin 1.1 their are stored follow Informations:

```auto
@file:kotlin.jvm.JvmVersion

package kotlin.collections

@SinceKotlin("1.1") public typealias RandomAccess = java.util.RandomAccess

@SinceKotlin("1.1") public typealias ArrayList<E> = java.util.ArrayList<E>
@SinceKotlin("1.1") public typealias LinkedHashMap<K, V> = java.util.LinkedHashMap<K, V>
@SinceKotlin("1.1") public typealias HashMap<K, V> = java.util.HashMap<K, V>
@SinceKotlin("1.1") public typealias LinkedHashSet<E> = java.util.LinkedHashSet<E>
@SinceKotlin("1.1") public typealias HashSet<E> = java.util.HashSet<E>

// also @SinceKotlin("1.1")
internal typealias SortedSet<E> = java.util.SortedSet<E>
internal typealias TreeSet<E> = java.util.TreeSet<E>

```

so kotlin.ArrayList is just an alias for the Java Version java.util.ArrayList.  
java.utilArrayList extends AbstractList and implements List, RandomAccess, Cloneable, java.io.Serializable.

so its not implements MutableList. So how is it possible that the code:

```auto
var myList:MutableList<String>=ArrayList<String>()

```

works when ArrayList not implementing MutableList? A Soloution would be a Class extension, but as i Understand know you can only extends Funktions or Propertys.

---

<div class="post-metadata">

**Author:** ![jstuyts](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstuyts/32/2141_2.png) [@jstuyts](https://discuss.kotlinlang.org/u/jstuyts)\
**Post date:** [January 9, 2018, 7:21am UTC](https://discuss.kotlinlang.org/t/how-can-java-util-arraylist-inherit-from-mutablelist/6146/2 "2018-01-09T07:21:38Z")

</div>

`java.util.List` is mapped to `MutableList` (or `List` depending on the type of the variable the list is assigned to): [http://kotlinlang.org/docs/reference/java-interop.html#mapped-types](http://kotlinlang.org/docs/reference/java-interop.html#mapped-types)
