Prezados colegas,
Tenho a seguinte situação: 7 TreeMaps que armazenam um índice e a informação sobre divesas mídidas (.txt, .wav, .jpg, .gif, .png, .mpg e .avi).
Como posso imprimir todos os conteúdos (Key, Value) da forma abaixo (descartando o cabeçalho):
K TXT WAV JPG GIF PNG MPG AVI
0 Ocupado Ocupado Vazio Vazio Vazio Ocupado Vazio
1 Vazio Ocupado Vazio Vazio Vazio Ocupado Vazio
2 Ocupado Vazio Vazio Vazio Vazio Vazio Vazio
Segue abaixo o trecho do código que escreví:
import java.util.TreeMap;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.Map;
public class TreeMapTest {
public static void main(String[] args) {
TreeMap<Integer, String> tmTXT = new TreeMap<Integer, String>();
TreeMap<Integer, String> tmWAV = new TreeMap<Integer, String>();
TreeMap<Integer, String> tmJPG = new TreeMap<Integer, String>();
TreeMap<Integer, String> tmGIF = new TreeMap<Integer, String>();
TreeMap<Integer, String> tmPNG = new TreeMap<Integer, String>();
TreeMap<Integer, String> tmMPG = new TreeMap<Integer, String>();
TreeMap<Integer, String> tmAVI = new TreeMap<Integer, String>();
tmTXT.put(0, "Ocupado");
tmWAV.put(0, "Vazio ");
tmJPG.put(0, "Vazio ");
tmGIF.put(0, "Vazio ");
tmPNG.put(0, "Vazio ");
tmMPG.put(0, "Vazio ");
tmAVI.put(0, "Vazio ");
tmTXT.put(1, "Ocupado");
tmWAV.put(1, "Vazio ");
tmJPG.put(1, "Ocupado");
tmGIF.put(1, "Vazio ");
tmPNG.put(1, "Vazio ");
tmMPG.put(1, "Vazio ");
tmAVI.put(1, "Vazio ");
tmTXT.put(2, "Vazio ");
tmWAV.put(2, "Ocupado");
tmJPG.put(2, "Ocupado");
tmGIF.put(2, "Vazio ");
tmPNG.put(2, "Vazio ");
tmMPG.put(2, "Ocupado");
tmAVI.put(2, "Vazio ");
Set<Map.Entry<Integer, String>> setTXT = tmTXT.entrySet();
Set<Map.Entry<Integer, String>> setWAV = tmWAV.entrySet();
Set<Map.Entry<Integer, String>> setJPG = tmJPG.entrySet();
Set<Map.Entry<Integer, String>> setGIF = tmGIF.entrySet();
Set<Map.Entry<Integer, String>> setPNG = tmPNG.entrySet();
Set<Map.Entry<Integer, String>> setMPG = tmMPG.entrySet();
Set<Map.Entry<Integer, String>> setAVI = tmAVI.entrySet();
int sizeSetTXT = setTXT.size();
/**
Aqui é que gostaria de imprimir a chave de um SET e os valores de cada um lado a lado.
*/
Agradecendo antecipadamente qualquer ajuda,
Augusto