All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arextest.diff.utils.JSONParseUtil Maven / Gradle / Ivy

The newest version!
package com.arextest.diff.utils;

import com.arextest.diff.model.log.NodeEntity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class JSONParseUtil {

  public static Map> getTotalParses(
      Map, String> leftParseNodePaths,
      Map, String> rightParseNodePaths) {

    Set> leftSet = new HashSet<>(leftParseNodePaths.keySet());
    Set> rightSet = new HashSet<>(rightParseNodePaths.keySet());

    Map> parseNodePaths = new HashMap<>();

    for (List leftPath : leftSet) {
      parseNodePaths.put(ListUti.convertPathToStringForShow(leftPath),
          new ArrayList() {{
            add(leftParseNodePaths.get(leftPath));
            add(rightParseNodePaths.getOrDefault(leftPath, ""));
          }});
      rightSet.remove(leftPath);
    }
    for (List rightPath : rightSet) {
      parseNodePaths.put(ListUti.convertPathToStringForShow(rightPath),
          new ArrayList() {{
            add("");
            add(rightParseNodePaths.get(rightPath));
          }});
    }
    return parseNodePaths;
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy