Question: How do I test a HashMap in main()? public static void asNestedObject1( HashMap index, Writer writer, int level) throws IOException { { if (index.isEmpty()) {

How do I test a HashMap > in main()?

public static void asNestedObject1(HashMapHashSet> index,

Writer writer, int level) throws IOException {

{

if(index.isEmpty()) {

try {

writer.write("{" + System.lineSeparator() + "}");

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

else {

int count = 0;

writer.write("{");

writer.write(System.lineSeparator());

for(EntryHashSet> entry : index.entrySet()) {

indent(level + 1, writer);

quote(entry.getKey(), writer);

writer.write(": ");

//indent(level, writer);

asArray1(entry.getValue(), writer, level + 1);

if(count < index.size() -1 ) {

writer.write(",");

writer.write(System.lineSeparator());

}

count++;

}

writer.write(System.lineSeparator());

writer.write("}");

}

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!