Advertisement
apurv5

Java Generics in Hadoop Writables

Aug 7th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. import java.io.DataInput;
  2. import java.io.DataOutput;
  3. import java.io.IOException;
  4.  
  5. import org.apache.hadoop.io.WritableComparable;
  6.  
  7. //public class IntWritable implements WritableComparable {
  8. class MyIntWritable implements WritableComparable<MyIntWritable>{
  9.  
  10.   @Override
  11.   public void write(DataOutput out) throws IOException {
  12.     // TODO Auto-generated method stub
  13.    
  14.   }
  15.  
  16.   @Override
  17.   public void readFields(DataInput in) throws IOException {
  18.     // TODO Auto-generated method stub
  19.    
  20.   }
  21.  
  22.   @Override
  23.   public int compareTo(MyIntWritable o) {
  24.     // TODO Auto-generated method stub
  25.     return 0;
  26.   }
  27.  
  28.  
  29.  
  30. }
  31.  
  32. public class A{
  33.  
  34.   public static class Inner
  35.   <KEY extends WritableComparable<? super KEY>>{
  36.    
  37.   }
  38.  
  39.   public static void main(String[] args){
  40.     A.Inner<MyIntWritable> a = new A.Inner<MyIntWritable>();
  41.     // A.Inner<IntWritable> a = new A.Inner<IntWritable>(); //CANNOT DO THIS CURRENTLY.
  42.   }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement