Java Lab #10: Collections

In this lab you will experiment some with the Java Collections library. You will also practice more with File I/O.

Proceed as follows

  1. Modify Clacky again so that when it starts it reads a configuration file named clacky.cfg. It is not an error if that file doesn't exist. The configuration file contains name/value pairs with one pair on each line in the following format:

            name=value
          

    You can assume there are no spaces around the equals sign but spaces inside the name or value are allowed. For example:

            Display Levels=5
          

    Clacky should ignore likes that are blank or that start with a '#' character. They can be used for comments.

            # Set the number of displayed stack levels.
            Display Levels=5
          

    Clacky should load the name/value pairs into a Map<String, String> object. It should then use the "Display Levels" setting to control the maximum number of stack levels that are printed before the command prompt. If the configuration file does not exist, use a sensible default value (you can pick it).

You can imagine defining other configurable parameters for Clacky and giving them names in the configuration file. I invite you to think of something else (but it's not required).

As a final optional step, consider exporting your program to an executable jar file as I demonstrated in the lecture. This would allow you to use Clacky outside of Eclipse and makes the program much more practical. Turn in your modified files with appropriate comments. I'm mostly interested in Clacky.java (or where ever you made your modifications). Be sure your name is on your submission.

Enjoy!