Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Java compatibility issues (WAS: MF having issues?)
"James J. Gavan" <jgavandeletethis@shaw.ca> wrote in message
news:uJNPf.128728$B94.114109@pd7tw3no... 
>
> Can't have a duplicate Key in a collection anymore than you can have a
> duplicate key in a COBOL file. Try to add an element creating a duplicate
> key - it just gets ignored. I can have :
>
> Key---> then Data
> -----------------
> 12345 Micro Focus Ltd
> 12347 Micro Focus Ltd
>
> but I can't have :
>
> Micro Focus Ltd 12345
> Micro Focus Ltd 12347
>
> Wasn't too clear about your reference to Pairs - but the following example
> from Adele Goldberg (Smalltalk 80) is allowable to find 'Opposites' from
> the Key :-
>
> Key---> then Data
> -----------------
> hot cold
> push pull
> stop go
> come go
> front back
> top bottom
>
> I think 'Pairs' you are possibly referring to something slightly different
> ?

Yes, I meant something different.

In Java as well, you can't have a dictionary (though it's called a "Map"
in Java) where two objects have the same key. I was saying you could "fake"
it by having a "Pair" object whose sole purpose is to contain references to
the two objects you *do* want to store.

Key --> Data
123    (Hot, Cold)
124    (push, pull)
125    (stop, go)
etc.

The idea is that only one object, the "pair" object, is associate with a
given key. But the pair object is like a collection whose size is guaranteed
to always be 2. Obviously, you can extend this idea if you wanted to
simulate 3 objects per key:

Key --> Data
123   (Hot, Warm, Cold)
124   (push, rest, pull)
125   (red, green, blue)
etc.

- Oliver


Report this thread to moderator Post Follow-up to this message
Old Post
Oliver Wong
03-09-06 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:35 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.