title: Can I create extensions in Java like I do in C#?
body: <p>I am posting a C# example of extension usage, to make my question more clear. I have a simple class called Parameter with two properties: a key and a value. And I am extending the List of Parameters to be able to check if a certain key is contained in the List:</p>
  
  <p>Parameter Class:</p>
  
  <pre><code>public class Parameter
  {
      private String key { get; set; }
      private String value { get; set; }
  }
  </code></pre>
  
  <p>Parameter Extension Class:</p>
  
  <pre><code>public static class ParameterListExtension
  {
      public static bool contain(this List&lt;Parameter&gt; parameters, String key)
      {
          foreach (Parameter parameter in parameters) {
              if (parameter.key.Equals(key)) { return true; } }
          return false;
      }
  }
  </code></pre>
  
  <p>Usage of Extension:</p>
  
  <pre><code>List&lt;Parameter&gt; parameters = getParameters();
  if (parameters.contain("myParameter")) { ... }
  </code></pre>
  
  <p>Can this be done in Java?</p>