Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LinkedList {
- private LinkedListNode head;
- public boolean find(Object item){
- // write a find method that returns true if item is in the LinkedList
- LinkedListNode current = head;
- if (item.equals(current.getData())){
- return true;
- }else{
- return false;
- }
- }
- public class PowerScrabble {
- private LinkedList Lexicon;
- public PowerScrabble(){
- // declare a new/empty Lexicon Attribute:
- this.Lexicon = new LinkedList();
- // Open up LEXICON file and read in all the words and insert them in the Lexicon LinkedList
- try {
- Scanner myScan = new Scanner(new File("LEXICON"));
- while (myScan.hasNext()) {
- String myWord = myScan.next().toLowerCase();
- myScan.nextLine();
- Lexicon.insertBack(myWord);
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- public String findBestMatch(String letters){
- String LetterCombos[] = generateLetterCombinations(letters);
- for(int i = 0; i < LetterCombos.length; i++){
- // Not sure how to go about pulling strings from the Lexicon LinkedList
- }
- return "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement