/********************************************************************* Author: Dana Vrajitoru, IUSB, CS Class: C243 Data Structures File name: ListWordC.java Last updated: April 2022 Description: Implementation of a list of WordCounter's. **********************************************************************/ package hashTable; import java.util.ArrayList; import java.util.List; public class ListWordC { List list; // Constructor ListWordC() { list = new ArrayList (); } // Delete all the contents void clear() { list.clear(); } void insert(WordCounter wordc) { list.add(wordc); } void remove(WordCounter wordc) { WordCounter save = null; for (WordCounter wdc : list) if (wdc.contains(wordc.word)) save = wdc; if (save != null) list.remove(save); } int size() { return list.size(); } boolean isEmpty() { return list.isEmpty(); } boolean findWord(WordCounter copyWord, String word) { for (WordCounter wdc : list) { if (wdc.contains(word)) { copyWord.copy(wdc); // first retrieve the data return true; } } return false; } }