FixdLenStringList.java

import java.util.ArrayList; import java.util.Random; /** * FixdLenStringList defines a list of strings and a string length. All * strings in the FixdLenStringList have the same length. There is no * present number of strings that a FixdLenStringList can hold. */ public class FixdLenStringList { private final int strLength; private ArrayList<String> availableStrings; /** * Constructor for FixedLenStringList that initializes strLength ( the * length of the strings in FixdLenStringList's list) and possibleStrings * (FixdLenStringList's list of strings). * * @param len the length of the FixdLenStringList's strings. */ public FixdLenStringList(int len) { strLength = len; availableStrings = new ArrayList<String>(); } /** * Gets the length of a string in FixdLenStringList * * @return length of the individual the strings in FixdLenStringList */ public int getStringLength() { // Your code goes here } /** * Returns the string in position x of FixdLenStringList's list * implementation. The first string is in position 0. Precondition: 0 <= x < * availableStrings.length @param x an index * * value in the FixdLenStringList * @return returns the xth entry in FixdLenStringList */ public String getString(int x) { // Your code goes here } /** * Returns true if the string, key, is found in the FixdLenStringList's list * of strings, false otherwise. * * @param key the string we are searching for * @return true if key is found in FixdLenStringList; false otherwise */ public boolean found(String key) { // Your code goes here } /** * Adds the string, entry, to FixdLenStringList's list implementation if it * is the correct length and not already in the list. If the string is * already in the list or if the string is not the correct length, it is not * added. * * @param entry string to add to FixdLenStringList */ public void addString(String entry) { // Your code goes here } /** * Removes and returns a random string entry from the FixdLenStringList's * list of strings. Precondition: the FixdLenStringList's list must not be * empty. * * @return a random string from FixdLenStringList */ public String removeRandomString() { // Your code goes here } }