FastLookupTable<T> constructor

FastLookupTable<T>(
  1. Map<int, T> data
)

Implementation

FastLookupTable(Map<int, T> data) {
  var maxIndex = data.keys.first;

  for (var key in data.keys) {
    if (key > maxIndex) {
      maxIndex = key;
    }
  }

  this._maxIndex = maxIndex;

  _table = List<T?>.filled(maxIndex + 1, null);

  for (var entry in data.entries) {
    _table[entry.key] = entry.value;
  }
}