I\'d like to create new item that similarly to Util.Map.Entry that will contain the structure key, value.
The problem is that
Example of AbstractMap.SimpleEntry:
import java.util.Map;
import java.util.AbstractMap;
import java.util.AbstractMap.SimpleEntry;
Instantiate:
ArrayList> arr =
new ArrayList>();
Add rows:
arr.add(new AbstractMap.SimpleEntry(2, 3));
arr.add(new AbstractMap.SimpleEntry(20, 30));
arr.add(new AbstractMap.SimpleEntry(2, 4));
Fetch rows:
System.out.println(arr.get(0).getKey());
System.out.println(arr.get(0).getValue());
System.out.println(arr.get(1).getKey());
System.out.println(arr.get(1).getValue());
System.out.println(arr.get(2).getKey());
System.out.println(arr.get(2).getValue());
Should print:
2
3
20
30
2
4
It's good for defining edges of graph structures. Like the ones between neurons in your head.