Hello,
I'm new to java and my problem is this:
class Word {
private String _value;
public Word(String value) { _value = new String(value); }
}
//main
HashSet< Word > dictionary = new HashSet< Word >();
dictionary.add( new Word( "goodbye" );
dictionary.add( new Word( "hi" );
dictionary.add( new Word( "hello" );
if ( dictionary.contains( Word( "hello" ) )) ) { //how to to this?
}
class Word {
private String _value;
public Word(String value) { _value = new String(value); }
}
//main
HashSet< Word > dictionary = new HashSet< Word >();
dictionary.add( new Word( "goodbye" );
dictionary.add( new Word( "hi" );
dictionary.add( new Word( "hello" );
if ( dictionary.contains( Word( "hello" ) )) ) { //how to to this?
}
To copy to clipboard, switch view to plain text mode
I need to know if dictionary contains that word. I know it's simple but I can't do it
Any hints, please?
Bookmarks