title: Check Key existense in Optional<> in Kotlin
body: <p>I have a variable of type Optional&lt;&gt;, which I retrieve from the database</p>
  <p>Sample Optional&lt;&gt; type</p>
  <pre><code> _id : 123456677,
      accounts: array,
      external_users: array
  </code></pre>
  <p>Code</p>
  <pre><code>val Account = accountRepository.findById(accountId)
   if (Account.isPresent){
      Account.get().accounts.add(data)
  }
  </code></pre>
  <p>The Account is of type Optional&lt;&gt;. I want to check if the accounts array exists before adding data to it.In some cases, I won't have the accounts array in the collection. So I have to check if the array is present and then add the data, if it is not present I'll create the array</p>