View Full Version : word occurrences

03-18-2010, 07:29 PM
I have posted this in other forums and I am just trying to get the best help I can. I have a word occurrence project I have been stuck on. The pre-written test for the methods are not working so I was wondering if anyone can guide me the right direction. here is what i have and the test that is suppose to pass.

public void add(final String word, final int line) {
// TODO your job


public boolean containsKey (String word, int line){
if(word == null){
return false;
return true;

* (non-Javadoc)
* @see edu.luc.cs.laufer.index.Index#frequency(java.lang.String)
public int frequency(final String word) {
// TODO your job
return -1;


public void testAdd() {
int s = index.containsKey("xyz") ? index.get("xyz").size() : 0;
index.add("xyz", 5);
assertEquals(s + 1, index.get("xyz").size());

Any help would be most appreciated.