如图,用java处理,想获取以下数据形式该怎么写

图片说明

 两表关联,如A表字段1第一行所示,整个字段1想获取那样形式,用Java该怎么处理,用map集合方式带入去获取,获取的数据总是不完全,求指教
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

public class MapTestCase {

    @Test
    public void test(){

    //A 表字段2
    String[] array = {"张三,王五", "李四,王五", "张三,李四"};

    //B 表
    Map<String, String> dictMap = new HashMap<>(3);
    dictMap.put("A", "张三");
    dictMap.put("B", "李四");
    dictMap.put("C", "王五");

    //A表
    Map<String, String> resultMap = new HashMap<>(3);

    for (int i = 0; i < array.length; i++) {
        List<String> list = new ArrayList<>(2);
        String[] arr = array[i].split("\\,");
        for (int j = 0; j < arr.length; j++) {
            String name = arr[j];
            for (Entry<String, String> entry : dictMap.entrySet()) {
                if(name.equals(entry.getValue())){
                    list.add(entry.getKey());
                }
            }
        }
        String newKey = StringUtils.join(list, ",");
        resultMap.put(newKey, array[i]);
    }

    System.out.println(resultMap.toString());
}


}