org.apache.cxf.jaxrs.ext.multipart.Attachment attachments=null;
List<Attachment> clone = new ArrayList<Attachment>(attachments.size());
for(Object item: attachments)
clone.add((Attachment)item.clone());//The method clone() from the type Object is not visible
我想克隆List<Attachment> clone
对象,但它提示说方法Object中的clone()不可见。
Attachment
是否实现了Cloneable
接口,还是仅仅是一个接口,也就是说,Attachment
的实现是否实现了Cloneable
接口? - ThomasAttachment
上的clone
。也许有另一种克隆它们的方法,或者可能有完全不同的方法可以实现您想要的效果。顺便问一下,您的最终目标是什么? - Thomas