It works with any type of key and any type of value…for all Maps.
Here’s an example in PHP (this is just pulled from the webserver at work):
$headers = array(
"pid"=>"Part Number",
"serial"=>"Serial Number",
"entry_date"=>"Date",
"so_number"=>"Sales Order",
"account"=>"Account");
So, it’s pretty much just a Map, but it works natively in an array structure. So, to access any value, you just do:
$headers["pid"]
Using this you can create trees using just arrays and access stuff like this:
cars["sedans"]["two-door"]["green"]
Where “green” is an array in the “two-door” array which is in the “sedans” array, which is in the “cars” array. You can do this with Java, but when indexing with integers, it gets really confusing really fast. Or, you have to build a class to handle it, and even then, you have to do something like:
cars.get("sedan").get("two-door").get("green");
And just to be clear, the key/values can be any type. Considering PHP is very loosely typed ($var = new Date(); $var = array(); is valid), then it’s not a big deal. In Java, you’d have to use generics.
I’ve clarified already that I am not arguing against unary and binary operators, but that I am arguing against using (well established and defined) symbols for their naming.
I wasn’t waving my finger at anyone, but there’s probably someone reading it that way.
@Troncoso: so you should be getting what you want (more or less) in the next version then.
And lets change the most common keywords to whitespace characters!
public = \n
static = \t
private = \r
The fun thing would be that the code would all have to be on one line to avoid spamming public/private in the wrong places. No indentation either. Spaces only.
Oh, and if you managed all that, good luck distinguishing public and private. >:D
EDIT: What the… I just discovered a new smiley face. ^
Here’s a great idea.
I’d like the JVM to be the OS…
… and the browser too.
And there was a project back in the 90’s that I worked on, to make an open source version of Sun’s JavaOS: http://jos.sourceforge.net/