IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
InMemoryModuleFinder.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Collections.Immutable;
3using System.Linq;
4
6{
7
11 internal class InMemoryModuleFinder : ModuleFinder
12 {
13
14 readonly Dictionary<string, ModuleReference> _map;
15 readonly ImmutableHashSet<ModuleReference> _all;
16
21 public InMemoryModuleFinder(ImmutableArray<ModuleReference> references)
22 {
23 _map = references.ToDictionary(i => i.Descriptor.Name);
24 _all = references.ToImmutableHashSet();
25 }
26
28 public override ModuleReference? Find(string name)
29 {
30 return _map.GetValueOrDefault(name);
31 }
32
34 public override ImmutableHashSet<ModuleReference> FindAll()
35 {
36 return _all;
37 }
38
39 }
40
41}