由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Why Java needs clone interface?
相关主题
JAVA DOC 的问题请教: class private data member
Re: 问一个关于Java Native Interface的问题Windows 下 Java console application 的问题
[转载] help please on Java是不是spring mvc用的很少
JDBC or SQL-C?Re: what parts of Java you don't like? w
怎样才能使一个算法用于不同的数据结构?如何在WINDOWS上DEBUG JAVA
copy constructor都什么时候be called啊Please recommend a book for learning java
问个入门问题。一个土土的问题
An interview question.Java interfaceIs there a way to pass by value in Java?
相关话题的讨论汇总
话题: java话题: clone话题: why话题: interface话题: copy
进入Java版参与讨论
1 (共1页)
g*****g
发帖数: 34805
1
Folks, I am confused when one needs to implement clone interface
in java, can't java just copy memory like C++?
c*****t
发帖数: 1879
2
You can't do copy memory on a DAG. The result would be a tree.
You can't copy undirected graph or direct graph w/ circular
structures.

【在 g*****g 的大作中提到】
: Folks, I am confused when one needs to implement clone interface
: in java, can't java just copy memory like C++?

m******t
发帖数: 2416
3
IMHO, the actual reason is Java has to let the programmer decide
whether to make deep or shallow copy while cloning. In some cases,
a hybrid of deep and shallow copy is also possible.
Also, while it's not hard for Java to provide a generic clone utility,
it would have to be based on reflection (similar to how serialization
works), which could be faily expensive operations.
1 (共1页)
进入Java版参与讨论
相关主题
Is there a way to pass by value in Java?怎样才能使一个算法用于不同的数据结构?
git clones only one branch?copy constructor都什么时候be called啊
How does a client find and connect to a specific问个入门问题。
What specific services does a container provide fAn interview question.Java interface
JAVA DOC 的问题请教: class private data member
Re: 问一个关于Java Native Interface的问题Windows 下 Java console application 的问题
[转载] help please on Java是不是spring mvc用的很少
JDBC or SQL-C?Re: what parts of Java you don't like? w
相关话题的讨论汇总
话题: java话题: clone话题: why话题: interface话题: copy