title: How To Change Attributes in List of CustomObject in Scala?
body: <p>I am having following Case class </p>
  
  <pre><code>case class BIC( id: Option[Int], name: String, description: Option[String],
                                      bId: Option[Int], amount: BigDecimal,
                                      createdBy: Option[Int], createdAt: Option[DateTime] )
  </code></pre>
  
  <p>my REST-API url is like following</p>
  
  <pre><code>POST    /api/v3/user/2/bid/23/create
  </code></pre>
  
  <p>Now userId = 2 and bId = 23 are coming From URL path params
  I am also having List of BIC incoming from POST Request JSON which does not contain userId and bId</p>
  
  <p>I am directly injecting incoming JSON to List[BIC], but all the objects in this list doesn't have createdBy (userId) and bId set.</p>
  
  <p>if I want to set these 2 parameters in each BIC objects of List[BIC] what is the approach I should follow?</p>
  
  <pre><code>            val lsttemp:List[BIC] = bicList
              val lst:List[BIC]
              lsttemp.foreach(x=&gt;{
                x.bId=inId
                x.createdBy = userId
                lst.add(x)
              })
  </code></pre>
  
  <p>I am trying above code but its not working.</p>