title: Re/Create an immutable object that contains an immutable object list
body: <p><strong>Background</strong></p>
  
  <p>I am trying to create an immutable object that contains a list of immutable objects, as well as object type totals within the list.</p>
  
  <p>I created a slightly sudo gist to try and show what I mean. </p>
  
  <p><a href="https://gist.github.com/JonathanMerritt/c9e0daf74308ea12085af8354cf87844" rel="nofollow noreferrer">Gist - Adjusting an immutable object that contains an immutable object list.</a></p>
  
  <p><strong>Explanation</strong></p>
  
  <p>My example shows how I'm currently doing it, it does work. However not for all cases.</p>
  
  <p>My <a href="https://gist.github.com/JonathanMerritt/c9e0daf74308ea12085af8354cf87844#file-veggiecart_veggiecartview-java" rel="nofollow noreferrer">VeggieCartView</a> will have a recyclerview that gets filled with a new/saved <a href="https://gist.github.com/JonathanMerritt/c9e0daf74308ea12085af8354cf87844#file-veggiecart_veggiecart-java" rel="nofollow noreferrer">VeggieCart</a>.</p>
  
  <p>Each VeggieCart has a list of veggies. Veggie totals etc...</p>
  
  <p>I then have a helper class <a href="https://gist.github.com/JonathanMerritt/c9e0daf74308ea12085af8354cf87844#file-veggiecart_veggiechanger-java" rel="nofollow noreferrer">VeggieChanger</a>, it contains an <code>rx.Consumer&lt;Veggie[]&gt;</code> that gets set and accepts any 1:1 veggie changes from the veggie views.</p>
  
  <p>The VeggieCartView sets the consumer so when any one veggie changes, it creates an updated cart using the changes' corresponding cart factory method. The adapter is used to change/retrieve its list.</p>
  
  <p><strong>Working and not</strong></p>
  
  <p>This works well for changing one at a time, however batching changes is throwing concurrency exceptions.</p>
  
  <p>I realize my gist is not runnable and doesn't show most boilerplate, and that I may be fundamentally wrong with some or all of my approaches. With that said I still hope someone can give me advice on how to better implement what I'm trying to do.</p>
  
  <p>If more information is needed to understand, please ask. Thank you for anybody who does have help to offer,</p>
  
  <p>Jon.</p>