Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Hashtable
Hashtable [message #83453] Thu, 26 June 2003 19:42 Go to next message
Eclipse UserFriend
Originally posted by: jayesh.patel.ansa2.com

We hope this the right place for this kind of
problem we're having at the moment.
This is a problem we never had until today, and up
until today the code was working
fine.

Our problem is this, we've been adding into an
instance of 'java.util.Hashtable' using
'put(object, value)' method. This is what is
happening:

- we add an object into the table, and shows up in
the inspector and the counter
increments by one.
- we add another object and the same thing
happens.
- we add another object and this time it replaces
the first object in the table, and get this
increments counter by one.

Our code carries on and some entries are added,
but a third get over written. Now the
interesting thing is that it is not random, it's
always the same objects, but the counter always
says that the more entries in the table, than
there really are. Before you even say it, both
the object and the value are not null, so don't
even go there.

We've checked our code/data time and time again,
there is nothing wrong there. The odd
thing is we was using eclipse 2.0.2 with 1.4.0
java. We updated to 2.1 eclipse and java
1.4.2, still get the same exact problem.

Is this a bug in our code, eclipse or jave?

Has anybody else encountered this problem?

We' checked the Sun java site for any similar
problems to this and found none.

Please help we're at our wits end.

Many thanks .....

Jayesh Patel
Re: Hashtable [message #83604 is a reply to message #83453] Fri, 27 June 2003 02:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: msolo.third-bit.com

Hi Jayesh,

> Our problem is this, we've been adding into an
> instance of 'java.util.Hashtable' using
> 'put(object, value)' method. This is what is
> happening:
>
> - we add an object into the table, and shows up in
> the inspector and the counter
> increments by one.
> - we add another object and the same thing
> happens.
> - we add another object and this time it replaces
> the first object in the table, and get this
> increments counter by one.

Yup, your observation is correct. A "no-duplicate" hashing algorithm may
choose to either overwrite or deny a colliding element. I suggest that you
refer to the documentation of the class java.util.Map for a more
detailed explanation.

http://java.sun.com/j2se/1.4.1/docs/api/java/util/Map.html

Matthew
Re: Hashtable [message #85801 is a reply to message #83453] Mon, 30 June 2003 16:01 Go to previous messageGo to next message
Eclipse UserFriend
My guess is you have a subtle bug in you equals() and/or hasCode() methods
on the
objects you use as the key. Check documentation for requirements.

Frank

"Jayesh Patel" <jayesh.patel@ansa2.com> wrote in message
news:bdg0cg$emv$1@rogue.oti.com...
>
> We hope this the right place for this kind of
> problem we're having at the moment.
> This is a problem we never had until today, and up
> until today the code was working
> fine.
>
> Our problem is this, we've been adding into an
> instance of 'java.util.Hashtable' using
> 'put(object, value)' method. This is what is
> happening:
>
> - we add an object into the table, and shows up in
> the inspector and the counter
> increments by one.
> - we add another object and the same thing
> happens.
> - we add another object and this time it replaces
> the first object in the table, and get this
> increments counter by one.
>
> Our code carries on and some entries are added,
> but a third get over written. Now the
> interesting thing is that it is not random, it's
> always the same objects, but the counter always
> says that the more entries in the table, than
> there really are. Before you even say it, both
> the object and the value are not null, so don't
> even go there.
>
> We've checked our code/data time and time again,
> there is nothing wrong there. The odd
> thing is we was using eclipse 2.0.2 with 1.4.0
> java. We updated to 2.1 eclipse and java
> 1.4.2, still get the same exact problem.
>
> Is this a bug in our code, eclipse or jave?
>
> Has anybody else encountered this problem?
>
> We' checked the Sun java site for any similar
> problems to this and found none.
>
> Please help we're at our wits end.
>
> Many thanks .....
>
> Jayesh Patel
>
>
Re: Hashtable [message #86249 is a reply to message #85801] Tue, 01 July 2003 05:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jayesh.patel.ansa2.com

Couple of you have given us a few pointers we have
to check, however
another observation we've made is the overwriten
key is put into the
'next' in the hashtable entry.

We'll check our string key objects, which is the
fustrating thing they are
all unique.

Many thanks .....

Jayesh Patel


"Frank Sauer" <frank.sauer@trcinc.com> wrote in
message news:bdq4v5$e5t$1@rogue.oti.com...
> My guess is you have a subtle bug in you
equals() and/or hasCode() methods
> on the
> objects you use as the key. Check documentation
for requirements.
>
> Frank
>
> "Jayesh Patel" <jayesh.patel@ansa2.com> wrote in
message
> news:bdg0cg$emv$1@rogue.oti.com...
> >
> > We hope this the right place for this kind of
> > problem we're having at the moment.
> > This is a problem we never had until today,
and up
> > until today the code was working
> > fine.
> >
> > Our problem is this, we've been adding into an
> > instance of 'java.util.Hashtable' using
> > 'put(object, value)' method. This is what is
> > happening:
> >
> > - we add an object into the table, and shows
up in
> > the inspector and the counter
> > increments by one.
> > - we add another object and the same thing
> > happens.
> > - we add another object and this time it
replaces
> > the first object in the table, and get this
> > increments counter by one.
> >
> > Our code carries on and some entries are
added,
> > but a third get over written. Now the
> > interesting thing is that it is not random,
it's
> > always the same objects, but the counter
always
> > says that the more entries in the table, than
> > there really are. Before you even say it, both
> > the object and the value are not null, so
don't
> > even go there.
> >
> > We've checked our code/data time and time
again,
> > there is nothing wrong there. The odd
> > thing is we was using eclipse 2.0.2 with 1.4.0
> > java. We updated to 2.1 eclipse and java
> > 1.4.2, still get the same exact problem.
> >
> > Is this a bug in our code, eclipse or jave?
> >
> > Has anybody else encountered this problem?
> >
> > We' checked the Sun java site for any similar
> > problems to this and found none.
> >
> > Please help we're at our wits end.
> >
> > Many thanks .....
> >
> > Jayesh Patel
> >
> >
>
Re: Hashtable [message #86445 is a reply to message #86249] Tue, 01 July 2003 10:02 Go to previous message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

Jayesh Patel wrote:

> Couple of you have given us a few pointers we have
> to check, however
> another observation we've made is the overwriten
> key is put into the
> 'next' in the hashtable entry.

Then it sounds like you have keys that are hashing to the same value and
Hashtable is behaving as expected. When 2 keys hash to the same value and
the keys aren't equal, the objects are chained together. The fact that
the item count is incrementing and the next field of entries is being
populated indicates that you are adding items to the table.

Have you tried printing toString on your Hashtable to dump out all of the
entries. I think that you will find that they all are there.


> We'll check our string key objects, which is the
> fustrating thing they are
> all unique.

> Many thanks .....

> Jayesh Patel


> "Frank Sauer" <frank.sauer@trcinc.com> wrote in
> message news:bdq4v5$e5t$1@rogue.oti.com...
> > My guess is you have a subtle bug in you
> equals() and/or hasCode() methods
> > on the
> > objects you use as the key. Check documentation
> for requirements.
> >
> > Frank
> >
> > "Jayesh Patel" <jayesh.patel@ansa2.com> wrote in
> message
> > news:bdg0cg$emv$1@rogue.oti.com...
> > >
> > > We hope this the right place for this kind of
> > > problem we're having at the moment.
> > > This is a problem we never had until today,
> and up
> > > until today the code was working
> > > fine.
> > >
> > > Our problem is this, we've been adding into an
> > > instance of 'java.util.Hashtable' using
> > > 'put(object, value)' method. This is what is
> > > happening:
> > >
> > > - we add an object into the table, and shows
> up in
> > > the inspector and the counter
> > > increments by one.
> > > - we add another object and the same thing
> > > happens.
> > > - we add another object and this time it
> replaces
> > > the first object in the table, and get this
> > > increments counter by one.
> > >
> > > Our code carries on and some entries are
> added,
> > > but a third get over written. Now the
> > > interesting thing is that it is not random,
> it's
> > > always the same objects, but the counter
> always
> > > says that the more entries in the table, than
> > > there really are. Before you even say it, both
> > > the object and the value are not null, so
> don't
> > > even go there.
> > >
> > > We've checked our code/data time and time
> again,
> > > there is nothing wrong there. The odd
> > > thing is we was using eclipse 2.0.2 with 1.4.0
> > > java. We updated to 2.1 eclipse and java
> > > 1.4.2, still get the same exact problem.
> > >
> > > Is this a bug in our code, eclipse or jave?
> > >
> > > Has anybody else encountered this problem?
> > >
> > > We' checked the Sun java site for any similar
> > > problems to this and found none.
> > >
> > > Please help we're at our wits end.
> > >
> > > Many thanks .....
> > >
> > > Jayesh Patel
> > >
> > >
> >
Previous Topic:GDK_USE_XFT anti-anti-aliasing issue
Next Topic:Remove all menus from workbench window
Goto Forum:
  


Current Time: Thu May 22 15:04:59 EDT 2025

Powered by FUDForum. Page generated in 0.03360 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top