Advertisement
Guest User

Untitled

a guest
May 27th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2. public void add(Song song){
  3. int pos = song.hashCode() % this.length;
  4. ListElement node = new ListElement(song,null);
  5. if(this.entries[pos]==null){
  6. this.entries[pos] = node;
  7. }else {
  8. this.entries[pos].setNext(node);
  9. }
  10.  
  11. }
  12.  
  13.  
  14.  
  15.  
  16. public Song lookupTitle(String titel) {
  17.  
  18. int pos = titel.hashCode() % this.length;
  19.  
  20.  
  21. ListElement node = this.entries[pos];
  22.  
  23. while(node != null) {
  24.  
  25. if(node.getValue().getTitel().equals(titel)) {
  26. return node.getValue();
  27. }
  28. node = node.getNext();
  29. }
  30. return null;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement