class SharedUtilities {

  static boolean compareReferenceToId(String reference, String id) {
    String[] refParts = reference.split("/");
    String[] idParts = id.split("/");
    if (refParts.length > idParts.length) {
      return refParts[1].equals(idParts[0]);
    } else if (refParts.length < idParts.length) {
      return refParts[0].equals(idParts[1]);
    } else { // same length
      if (refParts.length == 1) {
        return refParts[0].equals(idParts[0]);
      } else {
        return refParts[0].equals(idParts[0]) && refParts[1].equals(idParts[1]);
      }
    }
  }

}