系统设计:可插拔数据结构类

时间:2019-05-27 16:28:44

标签: system-design

我正在开发一个使用不同算法的应用程序,将它们进行比较并显示每种算法的执行时间。

所以我使用了策略模式:我创建了一个接口IAlgo,对于每种算法,我都创建了一个实现:Algo1实现了IAlgo

然后在主类AlgoExecutor中,我通过以下接口:

IAlgo algo = new Algo1();
new AlgoExecutor(algo).execute();

现在,我想显示具有不同数据结构(Map,Set,List等)的不同执行时间。我想了解系统设计方面的知识,

我想要一些可以直接插入的东西:

IAlgo algo = new Algo1();
IContainer container= new Container1();
new AlgoExecutor(algo, container).execute();

但是问题是,我找不到在AlgoExecutor中使用的统一返回类型。

谢谢。

0 个答案:

没有答案