import java.util.ArrayList;

public class hashCodes {
    // instance variables - replace the example below with your own
    private static ArrayList<String> words;
    
    public static void initWords(){
        words.add("apple");
        words.add("blueberry");
        words.add("cranberry");
        words.add("daikon");
        words.add("eggplant");
        words.add("figs");
        words.add("grapes");
        words.add("hackberry");
	    words.add("iceberg");
        words.add("jicama");
        words.add("kale");
        words.add("lemon");
        words.add("mango");
        words.add("nectarine");
        words.add("onion");
        words.add("persimmon");
        words.add("quince");
        words.add("rutabega");
        words.add("sorrel");
        words.add("tangerine");
    }
    
    public static void main(String[] args) {
        words = new ArrayList<String>();
	    initWords();
        for (int i = 0; i<words.size(); i++) {

		    System.out.format("word: %s  code: %d%n", words.get(i), words.get(i).hashCode());
	    }
        
	    char ch; 
	    String st;
    	for (ch = (char) 0; ch <= (char) 127; ch++) {
    		st = "" + ch;
    		System.out.format("str: %s  code: %d%n", st, st.hashCode());
    	}

    	for (ch = 'a'; ch < 'g'; ch++) {
    		st = "d" + ch;
    		System.out.format("str: %s  code: %d%n", st, st.hashCode());
    		System.out.println(st.hashCode() - (""+ch).hashCode());
    	}

    	for (ch = 'a'; ch < 'g'; ch++) {
    		st = "dd" + ch;
    		System.out.format("str: %s  code: %d%n", st, st.hashCode());
    		System.out.println(st.hashCode() - (""+ch).hashCode());
    	}
    	st="bB";
    	System.out.format("str: %s  code: %d%n", st, st.hashCode());
    	st="aa";
    	System.out.format("str: %s  code: %d%n", st, st.hashCode());


    }
    
}
/**
 * Class StrList represents a list of Strings; it is our own version
 * of List<String>. 
 * You create the list entries by using Add(), one at a time.
 * Once you have a list, you can print it. 
 * 
 * You can get the nth value with get(n), or set the nth value with set(n, val).
 * If n is out of range, get(n) returns 0 and set(n, val) does nothing.
 * 
 */

