Guest User

Untitled

a guest
Jul 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. public boolean equals(Object f) {
  2. if(!f.instanceof(FIFO)) {
  3. throw new ClassCastException("Wrong class type");
  4. }
  5.  
  6. if(this.size() != f.size())
  7. return false;
  8.  
  9. for(int i=0; i<f.size(); i++) {
  10. if(this.get(i) == null && f.get(i) != null)
  11. return false;
  12. if(!this.get(i).equals(f.get(i)))
  13. return false;
  14. }
  15.  
  16. return true;
  17. }
Add Comment
Please, Sign In to add comment