Advertisement
Guest User

Untitled

a guest
Mar 7th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. public class MyThing<T> implements Comparable<T> {
  2.    
  3.  private int value;
  4.  
  5.  
  6.     public MyThing(){
  7.      
  8.  }
  9.    
  10.     void setValue(int value){
  11.         this.value = value;
  12.     }
  13.  
  14.     int getValue(){
  15.         return this.value;
  16.     }
  17.  
  18.     @Override
  19.     public int compareTo(T other) {
  20.         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  21.    
  22.         if(this.value.compareTo(other.value) > 0){
  23.             return 1;
  24.         }
  25.    
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement