5 Replies Latest reply on Jul 4, 2013 12:31 AM by La VloZ

    Generics Question

    La VloZ

      Hello all

      How are you all??


      I have a little question for generics

      see these two examples


      public static void printList(List<?> list){
           for(Object elem : list){




      public static <T extends Object>void printList(List<T> list){
           for(T elem : list){


      they do the same thing i tried them

      i know that the first is non-generic method and the second is generic method (if i'm not wrong)

      but can someone tell me what's the diffrence between them which is the best practice and why??


      Thank you all