MemoryStateChange[] flatten() {
      List<MemoryStateChange> changes = StreamEx.iterate(this, Objects::nonNull, change -> change.getPrevious()).toList();
      Collections.reverse(changes);
      return changes.toArray(new MemoryStateChange[0]);
    }
MemoryStateChange[] flatten()