I have a class Group. In the class I have two fields, idGroup IdGroupGroup. Groups may be part of other groups. My class Group is defined in a HashMap<Integer,Integer>; the key is IdGroupGroup and value is idGroup. I want to search the map for a particular idGroup; can I use recursion to do this?
class Group
{
int idGroupe
String word
}
HashMap<Integer,Integer> GroupeGroupe = new HashMap<Integer,Integer>();
GroupeGroupe.put(idGroupeGroupe, idGroupe)
Given a vague question, I have to guess a lot, but perhaps it’s something like this you’re looking for:
Output:
1 -> 2 -> 4 -> 5
Or something like this:
Which prints: