title: Python-like list comprehension in Java
body: <p>Since Java doesn't allow passing methods as parameters, what trick do you use to implement Python like list comprehension in Java ?</p>
  
  <p>I have a list (ArrayList) of Strings. I need to transform each element by using a function so that I get another list. I have several functions which take a String as input and return another String as output. How do I make a generic method which can be given the list and the function as parameters so that I can get a list back with each element processed. It is not possible in the literal sense, but what trick should I use ?</p>
  
  <p>The other option is to write a new function for each smaller String-processing function which simply loops over the entire list, which is kinda not so cool.</p>