View Single Post
Old Nov 5th, 2006, 10:42 AM   #5
_James_
Newbie
 
Join Date: Sep 2006
Location: UK
Posts: 20
Rep Power: 0 _James_ is an unknown quantity at this point
LinkedList is a generic class so...

You create an array or LinkedList references so then you need to go and initialize the array in a loop i think.
LikedList<int>[] graph = new LinkedList<int>[100];

for(int i = 0; i != graph.length(); i++)
{
     graph[i] = new LinkedList<int>();
}

//now you can add stuff to it

graph[0].addLast(9999);

I think the code above is roughly correct, but with generics in java i am never sure if my syntax is right.

Dont kill me if its not coz i feel like i have been injested into a jet engine and blasted out the other end.

One a side note. Do you go to Bristol or UWE?
_James_ is offline   Reply With Quote