Advertisement
spete

Untitled

Nov 11th, 2011
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. What is the difference between these two class declarations?
  2.  
  3. public class OrderedList<E extends Comparable<E>>
  4.  
  5.  
  6. public class OrderedList<E extends Comparable>
  7.  
  8.  
  9.  //==========================================================================
  10.     //Node Class
  11.     //==========================================================================
  12.     static class Node<E>
  13.     {
  14.  
  15.         public E info;
  16.         public Node nextNode;
  17.  
  18.         public Node(E info)
  19.         {
  20.             this.info = info;
  21.             nextNode = null;
  22.         }
  23.  
  24.        
  25.         public int compareTo(Node<E> e)
  26.         {
  27.             if ((Integer) this.getInfo() > (Integer) e.getInfo())
  28.             {
  29.                 return 1;
  30.             }
  31.  
  32.             if ((Integer) this.getInfo() < (Integer) e.getInfo())
  33.             {
  34.                 return -1;
  35.             }
  36.             return 0;
  37.  
  38.         }
  39.     }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement