Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1.  
  2. public class PaarFeld<T> {
  3.     private Feld<T> a, b;
  4.     private int length;
  5.  
  6.     public PaarFeld(Feld<T> a, Feld<T> b) {
  7.         this.length = (a.size() < b.size()) ? a.size() : b.size();
  8.         this.a = a;
  9.         this.b = b;
  10.     }
  11.  
  12.     public Paar<T> get(int i) throws ArrayIndexOutOfBoundsException {
  13.         if(i < length) {
  14.             return new Paar<T>(a.get(i), b.get(i));
  15.         } else {
  16.             throw new ArrayIndexOutOfBoundsException();
  17.         }
  18.     }
  19.    
  20.  
  21.     public int size() {
  22.         return this.length;
  23.     }
  24.  
  25.    
  26.     public Paar<T> set(int i, Paar<T> result){
  27.         Paar<T> result1;
  28.         result1 =  new Paar <T>(a.get(i), b.get(i));
  29.         return result1;
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement