• + 0 comments

    if(head==null) System.out.println(""); else{ List list=new ArrayList(); while(head!=null){ list.add(head.data); head=head.next; } Collections.reverse(list); for(Integer d:list){ System.out.println(d); } }