View RSS Feed

Recent Blogs Posts

  1. Java Generic's Wildcards

    by , 02-18-2012 at 04:57 PM
    Consider a situation where you desire all List elements to be printed. This could be explained by the given code:
    Java Code: This is the code to explain printing of all elements
    public void processElements(List<Object> elements){
       for(Object o : elements){
    This method couldn’t be used along with List<String> instance. To sort out this problem, wildcard operator is used. For writing generic List by the help of wildcard operator, use this code.