title: Java Generic method : Sanitizing a list returned from database
body: <p>I was curious to know if we can have a common <code>generic</code> function to check for vulnerability for an <code>arraylist</code> that has returned <code>data</code> from <code>database</code>..Is there any java utility that we  can use or is it possible to create a single function that checks all type of <code>lists</code>. Currently i use a customized function for <code>List&lt;String&gt;</code>
  but then i can have <code>List&lt;Integer&gt;, List&lt;Object[]&gt;, List&lt;Object&gt;</code>. Please advise what can i do better.
  Below is my current function</p>
  
  <pre><code>public Boolean checkVulnerability(List&lt;String&gt; dataList)
  {
     for(String data: dataList)
     {
       if(data!=null &amp;&amp; !data.trim().equalsIgnoreCase("") 
                  &amp;&amp; (data.contains("=") || data.contains("\\") ||
                          data.contains("&lt;") || data.contains("&gt;")))
          {
              //redirect to vulnerability page
          }
     }
  }
  </code></pre>