title: How to check if List<BasicNameValuePair> contains a key?
body: <p>I have a class that builds a HttpResponse initializer. in one of the methods that should return the <code>BasicNameValuePair</code> I have to check if there is a entry in the list with key or name specified by String "name". </p>
  
  <pre><code>public List&lt;BasicNameValuePair&gt; getPostPairs() {
      if(mPostPairs == null || mPostPairs.size() &lt; 1) {
          throw new NullPointerException(TAG + ": PostPairs is null or has no items in it!");
      }
  
      //there is no hasName() or hasKey() method :(
      if(!mPostPairs.hasName("action")) {
          throw new IllegalArgumentException(TAG + ": There is no 'action' defined in the collections");
      }
  
      return mPostPairs;
  }
  </code></pre>
  
  <p>How to do this? if it is not possible with BasicNameValuePair, what would be the alternative? subclassing and adding the method?</p>
  
  <p>I need to use this for a HttpPost, which its setEntity only accepts this type:</p>
  
  <pre><code>public UrlEncodedFormEntity (List&lt;? extends NameValuePair&gt; parameters)
  </code></pre>