code: protected static List<EndpointInfo> compressEndpointInfo(List<EndpointInfo> endpoints) {
          List<EndpointInfo> others = new ArrayList<EndpointInfo>();
  
          EndpointPart rootPart = new EndpointPart();
  
          for (int i = 0; i < endpoints.size(); i++) {
              EndpointInfo endpoint = endpoints.get(i);
  
              if (endpoint.getEndpoint() != null
                      && endpoint.getEndpoint().length() > 1
                      && endpoint.getEndpoint().charAt(0) == '/') {
                  String[] parts = endpoint.getEndpoint().split("/");
  
                  buildTree(rootPart, parts, 1, endpoint.getType());
  
              } else {
                  others.add(new EndpointInfo(endpoint));
              }
          }
  
          // Construct new list
          List<EndpointInfo> info = null;
  
          if (endpoints.size() != others.size()) {
              rootPart.collapse();
  
              info = extractEndpointInfo(rootPart);
  
              info.addAll(others);
          } else {
              info = others;
          }
  
          // Initialise the endpoint info
          initEndpointInfo(info);
  
          return info;
      }
docs: This method compresses the list of endpoints to identify
  common patterns.
  
  @param endpoints The endpoints
  @return The compressed list of endpoints