reconcileOrder static method

List<String> reconcileOrder(
  1. Iterable<String> persisted,
  2. Iterable<String> liveIds
)

Reconcile a persisted pane order against the liveIds currently declared: keep persisted ids still live, in persisted sequence, then append newly declared ids in live order. The drop/append rule (§spec:view-stack) has one owner — reconcile resolves the persisted blob with it, and WorkbenchViewContainer applies it to its live order at build.

Implementation

static List<String> reconcileOrder(
  Iterable<String> persisted,
  Iterable<String> liveIds,
) {
  final live = liveIds.toList();
  final liveSet = live.toSet();
  final result = [for (final id in persisted) if (liveSet.contains(id)) id];
  final seen = result.toSet();
  for (final id in live) {
    if (seen.add(id)) result.add(id);
  }
  return result;
}