Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Hand extends TreeSet<E> {
  4.     TreeSet<E> hand = new TreeSet<E>();
  5.  
  6.     public Hand() {
  7.  
  8.     }
  9.  
  10.     public boolean add(E c) {
  11.         return hand.add(c);
  12.     }
  13.  
  14.     public boolean remove(E c) {
  15.         return hand.remove(c);
  16.     }
  17.  
  18.     public String toString() {
  19.         //hand.comparator();
  20.         return hand.toString();
  21.     }
  22.    
  23.     public boolean equals(Object o) {
  24.         if(this == o) return true;
  25.         if(this == null) return false;
  26.         if(o.getClass() != getClass()) return false;
  27.         TreeSet currentSet = (TreeSet<Card>) o;
  28.         if( !hand.equals(currentSet)) return false;
  29.         return true;        
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement