IdentityHashMap的用例 [英] Use cases for IdentityHashMap

查看:146
本文介绍了IdentityHashMap的用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁能告诉 IdentityHashMap 的重要用例是什么?

Could anyone please tell what are the important use cases of IdentityHashMap?

推荐答案

文件说:


此类的典型用法是
拓扑保留对象图
转换,例如序列化
或深度复制。要执行这样的
转换,程序必须
维护一个节点表,该节点表保持
跟踪已经处理的所有对象引用

节点表必须不等于不同的
对象,即使它们碰巧是
等于。这个
类的另一个典型用法是维护代理对象。
例如,一个调试工具
可能希望为程序中的每个对象维护一个代理对象
,这是
调试的。

A typical use of this class is topology-preserving object graph transformations, such as serialization or deep-copying. To perform such a transformation, a program must maintain a "node table" that keeps track of all the object references that have already been processed. The node table must not equate distinct objects even if they happen to be equal. Another typical use of this class is to maintain proxy objects. For example, a debugging facility might wish to maintain a proxy object for each object in the program being debugged.

这篇关于IdentityHashMap的用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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