> Programming Languages > Java
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on Java



Java - "Dictionary cl*** in Java" in Programming Languages


Old 09-05-2004   #1
....
 
Default Dictionary cl*** in Java

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.


 
Old 09-05-2004   #2
..e.. ..rsl..
 
Default Re: Dictionary cl*** in Java

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");

Steve
 
Old 09-05-2004   #3
..v.. ..ls..
 
Default Re: Dictionary cl*** in Java

"Steve Horsley" <shoot@the.moon> wrote in message
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


 
Old 09-06-2004   #4
..cha.. ..rgwar..
 
Default Re: Dictionary cl*** in Java

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.
 
Old 09-06-2004   #5
..or.. .. ..er..
 
Default Re: Dictionary cl*** in Java


"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.


 
Old 09-06-2004   #6
....
 
Default Re: Dictionary cl*** in Java

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.


 
Old 09-06-2004   #7
..e ..sperm..
 
Default Re: Dictionary cl*** in Java

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)
 
Old 09-06-2004   #8
..m ..ull..
 
Default Re: Dictionary cl*** in Java

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.
 
Old 09-06-2004   #9
..v.. ..ls..
 
Default Re: Dictionary cl*** in Java

"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


 
Old 09-06-2004   #10
..cha.. ..rgwar..
 
Default Re: Dictionary cl*** in Java

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.
 

Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0