title: How can I create a generic version of a method that creates a list
body: <p>Is it possible to create the below function into a generic function that I can re-use?</p>
  
  <p>I want to pass in a collection, and return a list of a particular property in the object.</p>
  
  <p>So far example I have this:</p>
  
  <pre><code>   private List&lt;Integer&gt; getPropertyABCIdsFromSomeObject(List&lt;SomeObject&gt; someObjects) {
          List&lt;Integer&gt; ids = new ArrayList&lt;Integer&gt;();
          for(SomeObject so : someObjects) {
              ids.add(so.getPropertyABCId());
          }
          return ids;
      }
  </code></pre>
  
  <p>So this method works only for type SomeObject, and returns a list of PropertyABCId.</p>
  
  <p>Now if I want a list of some other property, I have to replicate this function with very little that changes.</p>
  
  <p>Can generics save the day here?</p>