public List<HRegionLocation> getMetaRegionLocations() {
    ConcurrentNavigableMap<Integer, HRegionLocation> snapshot =
      cachedMetaLocations.tailMap(cachedMetaLocations.firstKey());
    if (snapshot.isEmpty()) {
      // This could be possible if the master has not successfully initialized yet or meta region
      // is stuck in some weird state.
      return Collections.emptyList();
    }
    List<HRegionLocation> result = new ArrayList<>();
    // Explicitly iterate instead of new ArrayList<>(snapshot.values()) because the underlying
    // ArrayValueCollection does not implement toArray().
    snapshot.values().forEach(location -> result.add(location));
    return result;
  }
Returns Optional list of HRegionLocations for meta replica(s), null if the cache is empty.
hbase-server/src/main/java/org/apache/hadoop/hbase/MetaRegionLocationCache.java