Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Hashtableception

Name: Anonymous 2012-11-19 9:12

Hello, I come seeking the wisdom of the wise.

I have this hashtable:

Hashtable<Integer, Hashtable<Integer, Node>> table = new Hashtable<Integer, Hashtable<Integer, Node>>();

How would I add a node to that? The closest I can get by referencing the API and google is:

table.put(0, table.put(0, current));

Name: Anonymous 2012-11-19 9:15

Fucking disgusting.

Name: Anonymous 2012-11-19 9:16

LOL, I love Gordon Ramsay.

Name: Anonymous 2012-11-19 9:18

Why don't you just use a pair of integers as the key?

Name: Anonymous 2012-11-19 9:26

Because I'm choosing to work with a dynamic tessellation in my coordinate system.  I've got to be able to separate the coordinates in other ways than simply Euclidean.

Turns out a HT of HTs works very well for linking anything from 3 Nodes (Triangular nodes) upwards to whatever I want.

Name: i hate java 2012-11-19 9:39

>>1

...
Node nodeA = new Node('shit');
Node nodeB = new Node('poop');
Hashtable<Integer, Node> node1 = new Hashtable<Integer, Node>();
node1.add(1, nodeA);
node1.add(2, nodeB);
Hashtable<Integer, Hashtable<Integer, Node>> table = new Hashtable<Integer, Hashtable<Integer, Node>>();

table.add(1001, node1);
...


Something like that. I don't have a java compiler installed to test this.

Name: Anonymous 2012-11-19 11:18

>>6
Terrible!

Name: Anonymous 2012-11-19 11:18

Hashtable<Integer, Hashtable<Integer, Node>> table = new Hashtable<Integer, Hashtable<Integer, Node>>();

You should already know the answer; you wrote it down yourself in the above code.


Hasthtable <Integer, Hashtable<Integer, Node>> table = new Hashtable<Integer, Hashtable<Integer, Node>>();
Hashtable<Integer, Node> t1 = new HashTable<Integer, Node>();
table.put(0, t1);

Name: Anonymous 2012-11-19 13:42

Hashtable<Integer, Hashtable<Integer, Node>> table = new Hashtable<Integer, Hashtable<Integer, Node>>();

Who the fuck lets shit like this exist?

Don't change these.
Name: Email:
Entire Thread Thread List