SHARE
TWEET

Untitled

a guest Sep 13th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private val mItems = ArrayList<Int>()
  2. (1..item_count).mapTo(mItems) { it }
  3.  
  4. /*
  5.  mItems will be: "1, 2, 3, 4, 5, ..., item_count"
  6. */
  7.    
  8. class ModelClass(var id: Int = 0, var status: String = "smth")
  9.    
  10. //?
  11. private val mItems = ArrayList<ModelClass>()
  12. (1..item_count).mapTo(mItems) { mItems[position].id = it } // Something like this
  13. //?
  14.    
  15. (1..item_count).mapTo(mItems) { ModelClass(it) }
RAW Paste Data
Top