Psijic
Psijic

Reputation: 992

Shortcut for MutableMap/HashMap

I have a slightly long class type: MutableLiveData<MutableMap<String, List<MyItems>>>. is it possible to make MutableMap<String, List<MyItems>> shorten with some kind of a data class or something like that without adding a lot of code?

Upvotes: 0

Views: 70

Answers (2)

John O&#39;Reilly
John O&#39;Reilly

Reputation: 10330

I may not be fully understanding the ask but could you just use something like:

typealias YourMapType = MutableMap<String, List<MyItems>>

Upvotes: 3

Patrick
Patrick

Reputation: 3759

class MyMap extends MutableMap<String, List<MyItems>> {}

Upvotes: 1

Related Questions