خرید بک لینک

Vote count: 1

I would like to know how to concatenate several list using a loop. Here is an example of what I'm trying to do:

object MyObj {
  var objs = Set (
    MyObj("MyObj1", anotherObjList),
    MyObj("MyObj2", anotherObjList)
  )

  val list = List.empty[AnotherObj]
  def findAll = for (obj <- objs) List.concat(list, obj.anotherObjList)
}

I would like the function findAll to concatenate lists from object of the set objs. I'm new to Scala, I find it to be a very interesting language, but with a confusing syntax. Thanks for help.

asked 9 mins ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 12 فروردين 1395 ساعت: 20:24

صفحه بندی