//このクラスは仮です package com.example.cosmos_serversb.jsons; import com.example.cosmos_serversb.entities.Group; import com.example.cosmos_serversb.entities.User; import java.util.*; public class GroupsMapJson { private ArrayList<GidUriJson> groups = new ArrayList<>(); public GroupsMapJson(User user){ changeGroupsMap(user.getGroups()); } public ArrayList<GidUriJson> getGroups(){ return groups; } public void setGroups(ArrayList<GidUriJson> groups){ this.groups = groups; } private void changeGroupsMap(Set set){ for ( Group group : (Set<Group>) set ) { groups.add(new GidUriJson(group)); } } }