title: Aerospike: atomically create a list if it does not exists and append items to this list
body: <p>The bin in aerospike is a <code>Map[String -&gt; List]</code></p>
  <p>I am trying to achieve the behavior as such:</p>
  <pre><code>bin.computeIfAbsent(key, k -&gt; new List()).addAll(itemsToAdd)
  </code></pre>
  <p>Is there a way to do this atomically in Aerospike without implementing a UDF?
  If I read the documentation correctly, if it was a <code>Map[String -&gt; Map]</code>, I could have used <code>CTX.mapKeyCreate</code> to create the inner Map on demand, but I don't see anything similar for creating a  List</p>
  <p><strong>UPD</strong>:
  Here is what I am trying to do</p>
  <p>I have a stream of triplets:</p>
  <pre><code>{&quot;pk&quot;,&quot;attr&quot;,&quot;value&quot;}
  </code></pre>
  <p>I need to sink this stream into aerospike set aggregating by <code>pk</code> and <code>attr</code> in the following format:</p>
  <pre><code>{
     &quot;PK&quot;:&quot;pk&quot;,
     &quot;mapBin&quot;: {
        &quot;attr&quot;: [&quot;value&quot;]
      }
  }
  </code></pre>
  <p>So let's say there are three items in the stream: <code>{&quot;pk&quot;,&quot;attr1&quot;,&quot;value1&quot;},{&quot;pk&quot;,&quot;attr2&quot;,&quot;value2&quot;},{&quot;pk&quot;,&quot;attr1&quot;,&quot;value3&quot;}</code></p>
  <p>They need to land in the aerospike as such:</p>
  <pre><code>{
     &quot;PK&quot;:&quot;pk&quot;,
     &quot;mapBin&quot;: {
        &quot;attr1&quot;: [&quot;value1&quot;,&quot;value3&quot;],
        &quot;attr2&quot;: [&quot;value2&quot;]
      }
  }
  </code></pre>
  <p>To insert a new item <code>{&quot;pk&quot;,&quot;attr2&quot;,&quot;value2&quot;}</code> I need to perform several actions:</p>
  <ol>
  <li>Get the list at <code>mapBin[attr2]</code></li>
  <li>If it does not exist, insert empty List into the map</li>
  <li>Do <code>ListOperation.append</code> to append the item to existing list</li>
  </ol>
  <p>Question is: is there a way to do it atomically without UDF?</p>