# Destructuring in lambas

**URL:** <https://discuss.kotlinlang.org/t/destructuring-in-lambas/1863>\
**Category:** Support\
**Created:** [July 13, 2016, 10:37am UTC](https://discuss.kotlinlang.org/t/destructuring-in-lambas/1863 "2016-07-13T10:37:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sksamuel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sksamuel/32/1904_2.png) [@sksamuel](https://discuss.kotlinlang.org/u/sksamuel)\
**Post date:** [July 13, 2016, 10:37am UTC](https://discuss.kotlinlang.org/t/destructuring-in-lambas/1863/1 "2016-07-13T10:37:47Z")

</div>

Is it possible to do something like this

```
val list : List<Pair<T,U>> = ...
list.map { a,b -> .... }

```

---

<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:** [July 13, 2016, 10:39am UTC](https://discuss.kotlinlang.org/t/destructuring-in-lambas/1863/2 "2016-07-13T10:39:42Z")

</div>

This will be possible in Kotlin 1.1.

---

<div class="post-metadata">

**Author:** ![sksamuel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sksamuel/32/1904_2.png) [@sksamuel](https://discuss.kotlinlang.org/u/sksamuel)\
**Post date:** [July 13, 2016, 10:57am UTC](https://discuss.kotlinlang.org/t/destructuring-in-lambas/1863/3 "2016-07-13T10:57:25Z")

</div>

+1000

---

<div class="post-metadata">

**Author:** ![hastebrot](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/hastebrot/32/1438_2.png) [@hastebrot](https://discuss.kotlinlang.org/u/hastebrot)\
**Post date:** [July 15, 2016, 9:20am UTC](https://discuss.kotlinlang.org/t/destructuring-in-lambas/1863/4 "2016-07-15T09:20:43Z")

</div>

I think it will rather look like this (within parentheses):

```kotlin
list.map { (a, b) -> /*...*/ }

```

Proposal is here: [KEEP/destructuring-in-parameters.md at 50194f6068b56a1b05e7ed46a093f28c85622431 · Kotlin/KEEP · GitHub](https://github.com/Kotlin/KEEP/blob/50194f6068/proposals/destructuring-in-parameters.md)

I was a bit unsure, if it will make into 1.1 (before yole confirmed it will be included), because the proposal says `"Status: Under consideration"` and is not implemented in EAP 1.1-M01.

Also: Thanks to Java 8 support in 1.1-M01 it is now possible to use Java 8’s `forEach()` and use a `BiConsumer`:

```kotlin
mapOf("foo" to 1, "bar" to 2).forEach { key, value ->
    println("$key to $value")
}

```

---

<div class="post-metadata">

**Author:** ![hastebrot](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/hastebrot/32/1438_2.png) [@hastebrot](https://discuss.kotlinlang.org/u/hastebrot)\
**Post date:** [July 15, 2016, 10:53am UTC](https://discuss.kotlinlang.org/t/destructuring-in-lambas/1863/5 "2016-07-15T10:53:04Z")

</div>

> The implementations in Kotlin 1.1 M01 are prototypes of the functionality described in the KEEPs.

Now I understand when the KEEP proposal says `"Prototype: Implemented"`.

via: [https://blog.jetbrains.com/kotlin/2016/07/first-glimpse-of-kotlin-1-1-coroutines-type-aliases-and-more/](https://blog.jetbrains.com/kotlin/2016/07/first-glimpse-of-kotlin-1-1-coroutines-type-aliases-and-more/)
