title: use map function on condition in kotlin
body: <p>I have a list of items and I want to edit its values before using it. I am using the <code>map</code> function to update each item in it. But the catch here is, I want to only update the items when the list size is 1. I want to return the list as it is if the size is larger than 1. How can I achieve this?</p>
  
  <pre><code>myList.map {
        if(resources.getBoolean(R.bool.is_tablet) &amp;&amp; it.itemList.size&lt;6 &amp;&amp; it.layerType == DOUBLE_LIST) {
          it.layerType = SINGLE_LIST_AUTO
          it.itemList.forEach {sectionItem-&gt;
            sectionItem.layerType = SINGLE_LIST_AUTO
          }
          it
        }else{
          it
        }
      }
  </code></pre>