title: Get String value if present or null if not present using Java8 Stream
body: <p>I have a json similar like as shown below. The requirement is to get the key value based on the id. ie. lets say If Id is  <strong>A1</strong> key value should return <strong>2gAwIBAgIQKGZsKfAUzaJHVantyrwVdzANBgkqhkiG9w0BAQs</strong>. The key array will always conatins only one element.</p>
  
  <pre><code>{
    "keys": [
      {
        "id": "A1",
        "key": [
          "2gAwIBAgIQKGZsKfAUzaJHVantyrwVdzANBgkqhkiG9w0BAQs"
        ]
      },
       {
        "id": "A2",
        "key": [
          "swKQYDVQQDEyJhY2NvdW50cy5hY2Nlc3Njb250cm9sfsf2dew"
        ]
      },
       {
        "id": "A3",
        "key": [
          "EyJhY2NvdW50cy5hY2Nlc3Njb250cm9sLndpbmRvd3Mubdwe2"
        ]
      }
    ]
  }
  </code></pre>
  
  <p>To implement the above I have wrote the below code using Java8 Stream but the problem is that it returns <code>Optional&lt;KeyDetails&gt;</code> which again I needs to parse and get the key value</p>
  
  <pre><code>String keyDetails = "{\"keys\":[{\"id\":\"A1\",\"key\":[\"2gAwIBAgIQKGZsKfAUzaJHVantyrwVdzANBgkqhkiG9w0BAQs\"]},{\"id\":\"A2\",\"key\":[\"swKQYDVQQDEyJhY2NvdW50cy5hY2Nlc3Njb250cm9sfsf2dew\"]},{\"id\":\"A3\",\"key\":[\"EyJhY2NvdW50cy5hY2Nlc3Njb250cm9sLndpbmRvd3Mubdwe2\"]}]}";
  AccessKeys accessKeys = new ObjectMapper().readValue(keyDetails, AccessKeys.class);
  Optional&lt;KeyDetails&gt; filteredKey = accessKeys.getKeys().stream().filter(key-&gt; key.getId().equals("A3")).findAny();
  if(filteredKey.isPresent()) {
      String keyValue = filteredKey.get().getKey().get(0);
      System.out.println("keyValue==&gt;"+keyValue);
  }
  </code></pre>
  
  <p>What I want is to get <code>Optional&lt;String&gt;</code> instead of <code>Optional&lt;KeyDetails&gt;</code>. i.e if the id is present it should return just the key value which is present within the key array.</p>
  
  <p>Some condition that the json satisfies were:</p>
  
  <ul>
  <li>Sometimes there can be a situation for duplicate key id, in that case it should pick only one (first one)</li>
  <li>Key array will always contains one string value</li>
  </ul>
  
  <p>Can anyone please help me on this</p>