-2

I have this listview that has childs (Wall Pushup etc.) in a parent category (Beginner_Ex). How do I make a 'grandparent' for the parents?

-- I now have:

Parent --Child --Child --Child

What I want is:

Grandparent ---Parent ------Child ------Child

public static HashMap<String, List<String>> getInfo()
{
    HashMap<String, List<String>> ExDetails = new HashMap<String, List<String>>();

    List<String> Beginner_Ex = new ArrayList<String>();
    Beginner_Ex.add("Wall Pushup");
    Beginner_Ex.add("Knee Pushup");
    Beginner_Ex.add("Regular Pushup");
    Beginner_Ex.add("Assisted Pullup");
    Beginner_Ex.add("Leg Raise on Ground");

    ExDetails.put("Beginner", Beginner_Ex);
    ExDetails.put("Experienced", Experi_Ex);
    ExDetails.put("Advanced", Advanced_Ex);
    ExDetails.put("Expert", Expert_Ex);
    ExDetails.put("Impossible", Imposs_Ex);

    return ExDetails;
Sam Hosseini
  • 813
  • 2
  • 9
  • 17
Calis
  • 47
  • 1
  • 11
  • `ExDetails.put("grandParentA", Beginner_Ex)`? – mvd Sep 14 '15 at 20:23
  • Could you give a little more detail about what you're trying to do? I'm guessing these are exercises in the "Beginner_Ex" category, and then you might have an "Intermediate_Ex" category with other exercises. What would be an example of a grandparent category? – Evan LaHurd Sep 14 '15 at 20:29
  • I have this list of exercises catagorized by parents, like beginner_ex. I also want to catagorize all the parents like beginner_ex to a 'grandparent' catagory namely 'Difficulity'. – Calis Sep 14 '15 at 20:30
  • Let me know if that's easier to understand! – Calis Sep 14 '15 at 20:32

1 Answers1

0

How about this ? Using Multi-level HashMaps..

Best Practices for Using Multi Level HashMap in Java

Community
  • 1
  • 1
Bruce Lan
  • 347
  • 2
  • 6