在不进行测试的情况下确定Java方法是否为深度复制的一般规则是什么?

在不进行测试的情况下确定Java方法是否为深度复制的一般规则是什么?,java,Java,下面是一个(典型的?)示例,取自List.addAll文档,它似乎没有说明添加到目标列表中的内容是否为深度副本。除了测试之外,什么是快速解析文档的通用方法或通用理解方法,可以确定标准Java类和方法是否深度复制 addAll 布尔加法(集合<P>除非某些东西指定它需要一个深拷贝,否则我总是假设它不存在。特别是当它依赖于支持克隆的对象本身时,它是非常罕见的,尤其是因为它依赖于支持克隆的对象。 < P>除非某些东西指定它需要一个深拷贝,否则我总是假设它不存在。特别是它依赖于支持克隆的对象本身。在Ja

下面是一个(典型的?)示例,取自List.addAll文档,它似乎没有说明添加到目标列表中的内容是否为深度副本。除了测试之外,什么是快速解析文档的通用方法或通用理解方法,可以确定标准Java类和方法是否深度复制

addAll
布尔加法(集合<P>除非某些东西指定它需要一个深拷贝,否则我总是假设它不存在。特别是当它依赖于支持克隆的对象本身时,它是非常罕见的,尤其是因为它依赖于支持克隆的对象。

< P>除非某些东西指定它需要一个深拷贝,否则我总是假设它不存在。特别是它依赖于支持克隆的对象本身。

在Java标准API上没有进行深度复制的方法。深度复制通常只通过序列化隐式地发生(也可能是克隆,但我从未见过这种情况),一些框架/库可能通过实用程序方法显式提供此功能,但这是一个罕见的例外,甚至不可能对任意
对象执行此操作。

Java标准API上没有执行深度复制的方法。深度复制通常只通过序列化隐式进行(也可能是克隆,但我从未见过这种情况),一些框架/库可能通过实用方法显式提供这种功能,但这是一个罕见的例外,甚至不可能对任意
对象
s执行

addAll

boolean addAll(Collection<? extends E> c)

    Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)

    Specified by:
        addAll in interface Collection<E>

    Parameters:
        c - collection containing elements to be added to this list 
    Returns:
        true if this list changed as a result of the call 
    Throws:
        UnsupportedOperationException - if the addAll operation is not supported by this list 
        ClassCastException - if the class of an element of the specified collection prevents it from being added to this list 
        NullPointerException - if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null 
        IllegalArgumentException - if some property of an element of the specified collection prevents it from being added to this list
    See Also:
        add(Object)