我正在尝试通过对象将值插入到哈希映射中,并且我想检查这些值是否插入到哈希映射中。所以我正在使用这段代码,但在运行时我无法获得任何输出。
如何解决这个问题?
代码:
import java.util.*;
import java.io.*;
import java.lang.*;
public class TaskList
{
private static HashMap<Integer, Object[]> dataz = new HashMap<Integer,Object[]>();
private static HashMap<Integer, Object[]> screen_dataz = new HashMap<Integer,Object[]>();
public final static Object[][] longValues = {{"10", "kstc-proc", "10.10.10.10.10.","5","O"},{"11", "proc-lvk1", "12.1.2.","4","O"},{"13", "trng-lvk1", "4.6.1.","3","O"}};
private static String sl,pid,tid,mval,status;
public static void main(String args[])
{
addTask();
}
public static void addTask()
{
for (int k=0; k<longValues.length; k++)
{
screen_dataz.put(k,longValues);
}
Set mapSet = (Set) screen_dataz.entrySet();
Iterator mapIterator = mapSet.iterator();
while (mapIterator.hasNext())
{
Map.Entry mapEntry = (Map.Entry) mapIterator.next();
String keyValue = (String) mapEntry.getKey();
String value = (String) mapEntry.getValue();
System.out.println(value);
}
}
}