有人可以回答我有关HashMap的Dartlang问题吗? [英] Can somebody answer me a Dartlang question about HashMap?

查看:54
本文介绍了有人可以回答我有关HashMap的Dartlang问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


中的旧问题有人可以告诉我dartlang实例如何抽象Map类吗?


  1. 我怎么知道哪个子类扩展了抽象类Map?

  2. 我的另一个问题是,由于抽象类HashMap实现了Map接口,因此它没有实现 void clear()功能。我想知道Map接口的 void clear()函数是在哪里实现的?我在抽象的HashMap类中找不到它。

  1. How would I know which child class extends "abstract class Map"?
  2. My other question is that since abstract class HashMap implements Map interface, it does not implement void clear() function. I wonder where the void clear() function of the Map interface is implemented? I cannot find it in abstract HashMap class.


推荐答案

您可以先阅读地图文档


  1. 实现 Map 的内置类在以下列表中:

  1. Built-in classes that implement Map are listed under:


实现者

Implementers

HashMap HttpSession LinkedHashMap MapMixin MapView

HashMap HttpSession LinkedHashMap MapMixin MapView

如果您的意思是如何知道 Map 的工厂构造函数实例化的派生类,请再次文档中是这样的

If you mean how do you know which derived class is instantiated by Map's factory constructor, again, the documentation says so:


Map< K,V> 构造函数

创建一个Map实例使用默认实现LinkedHashMap。

Creates a Map instance with the default implementation, LinkedHashMap.


  • 如果您查看 HashMap ,它表示:

  • If you look at the documentation for HashMap, it says:


    clear ()→无效

    从地图上删除所有对。 [...]

    Removes all pairs from the map. [...]

    继承

    它明确告诉您 clear()实现是从基类继承的。如果您单击它,将带您到

    It explicitly tells you that the clear() implementation is inherited from a base class. If you click on it, it will take you to the class that it inherits it from.

    这篇关于有人可以回答我有关HashMap的Dartlang问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆