title: Filter array list of objects by specific value of key
body: <p>I have an array list like this  and i would like to get the value of the key "Total" for the Product Name - Leisure 1 but not sure how to search or iterate through an array list of objects in Java spring boot</p>
  
  <pre><code> "priceList": [
        {
          "Total": "10",
          "Stamp Duty": "10",
          "Main Policy": "0",
          "Product Name": "Leisure 1"
        },
        {
          "Total": "10",
          "Stamp Duty": "10",
          "Main Policy": "0",
          "Product Name": "Leisure 2"
        },
        {
          "Total": "10",
          "Stamp Duty": "10",
          "Main Policy": "0",
          "Product Name": "Leisure 3"
        },
        {
          "Total": "10",
          "Stamp Duty": "10",
          "Main Policy": "0",
          "Product Name": "Work 1"
        },
        {
          "Total": "10",
          "Stamp Duty": "10",
          "Main Policy": "0",
          "Product Name": "Work 2"
        }
      ]
  </code></pre>
  
  <p>i tried doing this. I created a function </p>
  
  <pre><code>public static &lt;K, V&gt; Stream&lt;K&gt; keys(Map&lt;K, V&gt; map, V value) {
          return map
            .entrySet()
            .stream()
            .filter(entry -&gt; value.equals(entry.getValue()))
            .map(Map.Entry::getKey);
      }
  </code></pre>
  
  <p>Then i tried to cast my array list to a map and tried to filter through the list to find the exact object but to no avail</p>
  
  <pre><code>priceList.stream().map(x -&gt; x.get("Total").toString()).filter(s -&gt; s.get("Product Name") == planHeader).collect(Collectors.toList());
  </code></pre>
  
  <p>How can i be able to loop through or search through an array of objects and filter by a specific value?</p>
  
  <p>Any help appreciated</p>