Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo(val bars: List<String> = ArrayList())
- class FooBar(val foo: Foo, val bar: String?)
- fun main(args: Array<String>) {
- val foo1 = Foo(listOf("a", "b", "c"))
- val foo2 = Foo()
- val foo3 = Foo(listOf("d"))
- val foo4 = Foo()
- // How can I map above objects into a list of:
- // FooBar(foo1, "a")
- // FooBar(foo1, "b")
- // FooBar(foo1, "c")
- // FooBar(foo2, null)
- // FooBar(foo3, "d")
- // FooBar(foo4, null)
- }
Add Comment
Please, Sign In to add comment