public static Map<String, PartitionedRegion> getAllColocationRegions(
      PartitionedRegion partitionedRegion) {
    Map<String, PartitionedRegion> colocatedRegions = new HashMap<>();
    List<PartitionedRegion> colocatedByRegion = partitionedRegion.getColocatedByList();
    if (colocatedByRegion.size() != 0) {
      List<PartitionedRegion> tempcolocatedRegions =
          new ArrayList<>(colocatedByRegion);
      do {
        PartitionedRegion pRegion = tempcolocatedRegions.remove(0);
        pRegion.waitOnBucketMetadataInitialization();
        colocatedRegions.put(pRegion.getFullPath(), pRegion);
        tempcolocatedRegions.addAll(pRegion.getColocatedByList());
      } while (!tempcolocatedRegions.isEmpty());
    }
    PartitionedRegion tempColocatedWith = partitionedRegion;
    while (true) {
      PartitionedRegion colocatedWithRegion = tempColocatedWith.getColocatedWithRegion();
      if (colocatedWithRegion == null) {
        break;
      } else {
        colocatedRegions.put(colocatedWithRegion.getFullPath(), colocatedWithRegion);
        tempColocatedWith = colocatedWithRegion;
      }
    }
    return colocatedRegions;
  }
An utility method to retrieve all partitioned regions(excluding self) in a colocation chain<br>
<p>
For example, shipmentPR is colocated with orderPR and orderPR is colocated with customerPR <br>
<br>
getAllColocationRegions(customerPR) --> List{orderPR, shipmentPR}<br>
getAllColocationRegions(orderPR) --> List{customerPR, shipmentPR}<br>
getAllColocationRegions(shipmentPR) --> List{customerPR, orderPR}<br>

@return List of all partitioned regions (excluding self) in a colocated chain
@since GemFire 5.8Beta
geode-core/src/main/java/org/apache/geode/internal/cache/ColocationHelper.java