posted 18 years ago
i don't think so; a List is "single-column" by definition. you should be able to sort it - i've never tried to do that in Java myself, but it shouldn't be very hard - but what'll be sorted are the individual items in the list.
but you're making headway; you're creeping up on the idea of making a two-item custom data type, storing objects of that in a list, and then sorting that list, here. that would be one way of making a "two-column list", and possibly the most direct one to get functionality equivalent to that description.
however, for reference, i'll try to explain how a Map (dictionary) works. it's a tremendously useful data type, and it's crucial to properly using several other languages (Perl, Python, AWK, and others).
a dictionary is basically a set of name==value mappings. each entry in the dictionary consists of a "key" (the name) and a "value". when you put stuff into the dictionary, you have to specify both key and value; to retrieve a value, you only have to know the key.
some people like to think of a dictionary as a special kind of array, where absolutely anything can serve as the index (the key), and you don't have to specify the size of the array when you declare it because it'll grow and shrink as needed. the term "associative array" (associating the values with the keys) is an older synonym for "dictionary".
dictionaries are usually implemented as hash tables behind the scenes (that's why Perl calls them "hashes"), and this is why you typically can't have duplicate keys in a dictionary. one name, normally, can only have one value - but that's not much of a concern; if you need more values, put them in a List and store that as the value.
Java has several kinds of dictionary (Map, in Java-ese) with different implementations behind the scenes. apart from the plain-vanilla hashtable-based version, there's one that maintains the keys in the order you created them, so you can iterate through them in FIFO sequence. another even keeps the keys sorted so you can iterate through them in order - fairly fancy; most languages make you extract the list of keys, sort that, and iterate through the result.