解决方法
外部哈希映射,键入类型为日期,类型为哈希映射的值.
内部哈希映射,其键类型为字符串,包含url,int类型的值包含访问次数.
C#中的示例:
// Outer hash map var visitsByDay = new Dictionary<DateTime,VisitsByUrl>(currentDate,new VisitsByUrl()); ... // inner hash map public class VisitsByUrl { public Dictionary<string,int> Urls { get; set; } public VisitsByUrl() { Urls = new Dictionary<string,int>(); } public void Add(string url) { if (Urls[url] != null) Urls[url] += 1; else Urls.Add(url,1); } }