|
|||||
|
|
#1 |
|
|
way in java where I can instantiate a dictionary, or use a static method such as below: Dictionary d = new Dictionary(whatever parameters) boolean shouldbetrue = d.isAWord("dog"); boolean shouldbefalse = d.isAWord("asdfg"); I know there is an obselete cl*** Dictionary in Java, but it doesn't seem to actually be a dictionary. Thanks in advance, sorry for the inconvenience. |
|
|
#2 |
|
|
> In java, let's say I have a string, "dog", and a string "asdfg". Is there a > way in java where I can instantiate a dictionary, or use a static method > such as below: > > Dictionary d = new Dictionary(whatever parameters) > boolean shouldbetrue = d.isAWord("dog"); > boolean shouldbefalse = d.isAWord("asdfg"); > > I know there is an obselete cl*** Dictionary in Java, but it doesn't seem to > actually be a dictionary. Thanks in advance, sorry for the inconvenience. > > I think the closest might be a java.util.Map, such as a HashMap: Map d = new HashMap(); d.put("dog", new Boolean(true)); d.put("asdff", new Boolean(false)); Boolean isaword = d.get("dog"); Steve |
|
|
#3 |
|
|
news:chfrq8$mjl$1@news.freedom2surf.net... > Hari wrote: > > In java, let's say I have a string, "dog", and a string "asdfg". Is there a > > way in java where I can instantiate a dictionary, or use a static method > > such as below: > > > > Dictionary d = new Dictionary(whatever parameters) > > boolean shouldbetrue = d.isAWord("dog"); > > boolean shouldbefalse = d.isAWord("asdfg"); > > > > I know there is an obselete cl*** Dictionary in Java, but it doesn't seem to > > actually be a dictionary. Thanks in advance, sorry for the inconvenience. > > > > > > I think the closest might be a java.util.Map, such as a HashMap: > > Map d = new HashMap(); > d.put("dog", new Boolean(true)); > d.put("asdff", new Boolean(false)); > Boolean isaword = d.get("dog"); I ***ume that everything that is not in the dictionary is not a word, so a Set might suffice. -- David Hilsee |
|
|
#4 |
|
|
David Hilsee wrote:
> I ***ume that everything that is not in the dictionary is not a word, so a > Set might suffice. Of course the standard API Set implementations are nothing but wrappers around the corresponding Maps that hide the (null) values. |
|
|
#5 |
|
|
"Michael Borgwardt" <brazil@brazils-animeland.de> wrote in message news:2q1iegFqhcc8U2@uni-berlin.de... > David Hilsee wrote: > > I ***ume that everything that is not in the dictionary is not a word, so a > > Set might suffice. > > Of course the standard API Set implementations are nothing but wrappers > around the corresponding Maps that hide the (null) values. I doubt that. Sets aren't even in the inheritance tree of Map. |
|
|
#6 |
|
|
Thanks everyone,
I see how you can add a certain object, and match it with another object. I didn't realize the functionality of Maps before, and thanks for introducing me to them. However, is there a built in reference of all the (standard) words in the English language somewhere in the Java API, or would I have to find some file on the net with the English words and make my program reference that? Thanks once again. |
|
|
#7 |
|
|
George W. Cherry wrote:
> > "Michael Borgwardt" <brazil@brazils-animeland.de> wrote in message > news:2q1iegFqhcc8U2@uni-berlin.de.. > > David Hilsee wrote: > > > I ***ume that everything that is not in the dictionary is not a word, so > a > > > Set might suffice. > > > > Of course the standard API Set implementations are nothing but wrappers > > around the corresponding Maps that hide the (null) values. However, some JVM might do it differently. > I doubt that. Sets aren't even in the inheritance tree > of Map. He was talking about implementation not inheritance. -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ================================================== ============ * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) |
|
|
#8 |
|
|
Hari wrote:
> Thanks everyone, > > I see how you can add a certain object, and match it with another object. I > didn't realize the functionality of Maps before, and thanks for introducing > me to them. However, is there a built in reference of all the (standard) > words in the English language somewhere in the Java API, No. Why would there be? > or would I have to > find some file on the net with the English words and make my program > reference that? Well, that's one approach. Another is to use any of a number of existing Java dictionaries which may be available out there. One place to start might be: http://jdictionary.sourceforge.net/index.html Jim S. -- Remove my extraneous mandibular appendages to reply via email. |
|
|
#9 |
|
|
"Michael Borgwardt" <brazil@brazils-animeland.de> wrote in message
news:2q1iegFqhcc8U2@uni-berlin.de... > David Hilsee wrote: > > I ***ume that everything that is not in the dictionary is not a word, so a > > Set might suffice. > > Of course the standard API Set implementations are nothing but wrappers > around the corresponding Maps that hide the (null) values. I was not aware of that. However, Set should at least be more intuitive than Map from an interface perspective. -- David Hilsee |
|
|
#10 |
|
|
George W. Cherry wrote:
>>Of course the standard API Set implementations are nothing but wrappers >>around the corresponding Maps that hide the (null) values. > > > I doubt that. Sets aren't even in the inheritance tree > of Map. Inheritance doesn't factor into it. A HashSet extends AbstractSet, but really only consists of a private HashMap instance and implementations of the Set methods that forward all calls to the corresponding Map methods, with null values. |