How to load a HashMap with all items from a Group<> guy, trying to write .java code; fumbling around on something that seems should be simple.

I have need to load a HashMap with a data that I am receiving from a class that is coming to be as a Group<>
Object model looks something like this;

VmGroupResource vmGroupResource = provider.getVmGroupResource(root.getVms());
Group<Vm> vms = vmGroupResource.getAllVms();

From there I need to put the data in the return data as a HashMap, but I get a type mismatch when I try to do;

(vccdata is the HashMap)
vccdata.putAll(Map) vms);

The IDE doesn't show me an error, but it throws an exception when debugging using NetBeans.
Michael KrumpeSolutions ArchitectAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Best post your code with the exception so we can see it in situ.
Michael KrumpeSolutions ArchitectAuthor Commented:
Working on that. Is my code though the proper way to push a Group<> into a a HashMap?
I don't recall Group being in the Java API.

Maybe you mean a collection, in which case you'd be referring to java Collections I reckon. In which case, pls take a shuftee at the API for it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Group<Vm> itself would have to be a Map. Somehow that seems unlikely
Michael KrumpeSolutions ArchitectAuthor Commented:
I am using an SDK provided class model. Drilling into the definition of Group, it looks like it is a type created in the class that extends Entity. It is pulling together some Json types from com.fasterxml.jackson.annotation, and then later adds
type, items, first, last, next, prev, build as interfaces.

the interface for .items is a List.

Thanks for pointing me in the direction to drill in a little more. That said, should I just treat it like a Collection and do:
for (Vm i: vms.getItems()) vccdata.put(i.getId(), i);

Open in new window

Should work... I think. Its giving me back 0 items as a size count. ... just want to make sure I'm doing it right before I bark up the SDK developer's tree.
Not objecting as such to your close request, but wondering if you are entirely in the clear with it, given CEHJ's comment, and then my lack of full understanding of your requirements. Question.
Michael KrumpeSolutions ArchitectAuthor Commented:
Feedback pointed me in the right direction to see it as a collection, which needed to be treated as its own for loop.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.