Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. public class LinkedList {
  2.  
  3. private LinkedListNode head;
  4.  
  5. public boolean find(Object item){
  6.  
  7. // write a find method that returns true if item is in the LinkedList
  8. LinkedListNode current = head;
  9. if (item.equals(current.getData())){
  10. return true;
  11. }else{
  12. return false;
  13. }
  14. }
  15.  
  16.  
  17. public class PowerScrabble {
  18.  
  19. private LinkedList Lexicon;
  20.  
  21. public PowerScrabble(){
  22.  
  23. // declare a new/empty Lexicon Attribute:
  24.  
  25. this.Lexicon = new LinkedList();
  26.  
  27. // Open up LEXICON file and read in all the words and insert them in the Lexicon LinkedList
  28.  
  29. try {
  30. Scanner myScan = new Scanner(new File("LEXICON"));
  31. while (myScan.hasNext()) {
  32. String myWord = myScan.next().toLowerCase();
  33. myScan.nextLine();
  34. Lexicon.insertBack(myWord);
  35. }
  36. } catch (FileNotFoundException e) {
  37. e.printStackTrace();
  38. }
  39. }
  40.  
  41. public String findBestMatch(String letters){
  42.  
  43. String LetterCombos[] = generateLetterCombinations(letters);
  44.  
  45. for(int i = 0; i < LetterCombos.length; i++){
  46. // Not sure how to go about pulling strings from the Lexicon LinkedList
  47. }
  48. return "";
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement