iAbdul iAbdul - 4 months ago 32
Java Question

How to make two dimensional LinkedList in java?

for example:

public static LinkedList<String, Double> ll = new LinkedList<String, Double>;


from your question, I think (not 100% sure) you are looking for java.util.LinkedHashMap<K, V>

in your case, it would be LinkedHashMap<String, Double>

from java doc:

Hash table and linked list implementation of the Map interface, with predictable iteration order. This implementation differs from HashMap in that it maintains a doubly-linked list running through all of its entries.

if you do want to get element by list.get(5), you could :

LinkedList<Entry<String, Double>>

so you can get Entry element by Entry entry = list.get(5), then entry.getKey() gives you the STring, and entry.getValue() gives you the Double.