IMultiMap ExtractValues wrong result type

Issue #144 closed
Andrew Baranov created an issue

Instead of

IMultiMap<TKey, TValue> = interface(IMap<TKey, TValue>)
function ExtractValues(const key: TKey): IReadOnlyCollection<TKey>;
end;

it should be

IMultiMap<TKey, TValue> = interface(IMap<TKey, TValue>)
function ExtractValues(const key: TKey): IReadOnlyCollection<TValue>;
end;

And in TMultiMapBase it is wrong cast from ICollection<TValue> to ICollection<TKey>:

function TMultiMapBase<TKey, TValue>.ExtractValues(
  const key: TKey): IReadOnlyCollection<TKey>;
var
  list: ICollection<TValue>;
begin
...
  Result := list as IReadOnlyCollection<TKey>;
end;

Comments (2)

  1. Log in to comment