本文整理了Java中java.util.LinkedList.clone()
方法的一些代码示例,展示了LinkedList.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.clone()
方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名:clone
[英]Returns a shallow copy of this LinkedList. (The elements themselves are not cloned.)
[中]返回此LinkedList的浅层副本。(图元本身未克隆。)
代码示例来源:origin: spring-projects/spring-framework
/**
* Create a new {@code ParseState} whose {@link LinkedList} is a {@link Object#clone clone}
* of that of the passed in {@code ParseState}.
*/
@SuppressWarnings("unchecked")
private ParseState(ParseState other) {
this.state = (LinkedList<Entry>) other.state.clone();
}
代码示例来源:origin: org.springframework/spring-beans
/**
* Create a new {@code ParseState} whose {@link LinkedList} is a {@link Object#clone clone}
* of that of the passed in {@code ParseState}.
*/
@SuppressWarnings("unchecked")
private ParseState(ParseState other) {
this.state = (LinkedList<Entry>) other.state.clone();
}
代码示例来源:origin: apache/ignite
/**
* Clones this set.
*
* @return Clone of this set.
* @throws CloneNotSupportedException
*/
@Override protected Object clone() throws CloneNotSupportedException {
GridListSet<V> clone = (GridListSet<V>)super.clone();
clone.vals = (LinkedList<V>)vals.clone();
clone.comp = comp;
clone.strict = strict;
return clone;
}
代码示例来源:origin: SpongePowered/SpongeAPI
/**
* Attempts to use native {@link Object#clone()} methods on available map
* types. If a list cannot be properly cloned, a new {@link ArrayList} is
* returned.
*
* @param list The list input
* @param <T> The value type
* @return A copied list
*/
@SuppressWarnings("unchecked")
public static <T> List<T> copyList(List<? extends T> list) {
try {
if (list instanceof ArrayList) {
return (List<T>) ((ArrayList<? extends T>) list).clone();
} else if (list instanceof LinkedList) {
return (List<T>) ((LinkedList<? extends T>) list).clone();
} else if (list instanceof CopyOnWriteArrayList) {
return (List<T>) ((CopyOnWriteArrayList<T>) list).clone();
}
} catch (Exception ignored) {
}
return new ArrayList<>(list);
}
代码示例来源:origin: oblac/jodd
/**
* Initializes file walking.
* Separates input files and folders.
*/
protected void init() {
rules.detectMode();
todoFiles = new LinkedList<>();
todoFolders = new LinkedList<>();
if (pathList == null) {
pathList = new LinkedList<>();
return;
}
if (pathListOriginal == null) {
pathListOriginal = (LinkedList<File>) pathList.clone();
}
String[] files = new String[pathList.size()];
int index = 0;
Iterator<File> iterator = pathList.iterator();
while (iterator.hasNext()) {
File file = iterator.next();
if (file.isFile()) {
files[index++] = file.getAbsolutePath();
iterator.remove();
}
}
if (index != 0) {
FilesIterator filesIterator = new FilesIterator(files);
todoFiles.add(filesIterator);
}
}
代码示例来源:origin: wiztools/rest-client
@Override
public ReqEntity getEntity() {
MultipartSubtype type = jd_options.getSelectedSubtype();
MultipartMode mode = jd_options.getSelectedMode();
ReqEntity entity = new ReqEntityMultipartBean(
(LinkedList<ReqEntityPart>)model.list.clone(), mode, type);
return entity;
}
代码示例来源:origin: Atmosphere/atmosphere
filteredMessageClone = (LinkedList<Object>) filteredMessage.clone();
代码示例来源:origin: c3p0/c3p0
private final LinkedList cloneOfUnused()
{
assert Thread.holdsLock( this );
return (LinkedList) unused.clone();
}
代码示例来源:origin: asterisk-java/asterisk-java
@SuppressWarnings("unchecked")
public Iterator<Peer> getIterator()
{
final List<Peer> clone = (LinkedList<Peer>) this.peerList.clone();
final List<Peer> tmpList = clone;
return tmpList.iterator();
}
代码示例来源:origin: org.picketbox/picketbox
@SuppressWarnings("unchecked")
public synchronized Object clone() throws CloneNotSupportedException
{
NestableGroup clone = (NestableGroup) super.clone();
if(clone != null)
clone.rolesStack = (LinkedList<Principal>)this.rolesStack.clone();
return clone;
}
代码示例来源:origin: org.picketbox/picketbox
@SuppressWarnings({"unchecked", "rawtypes"})
public synchronized Object clone() throws CloneNotSupportedException
{
NestablePrincipal clone = (NestablePrincipal) super.clone();
if(clone != null)
clone.principalStack = (LinkedList)this.principalStack.clone();
return clone;
}
代码示例来源:origin: stackoverflow.com
LinkedList l1 = new LinkedList();
l1.add("A");l1.add("B");
LinkedList l2 = (LinkedList)l1.clone();
out("l2 after clone: "+l2.size());
l2.remove(0);
out("l2 after remove: "+l2.size());
l1 = (LinkedList)l2.clone();
out("l1 cloned from l2: "+l1.size());
l1.remove(0);
out("l1 after remove :"+l1.size());
out("l2 after l1's remove:"+l2.size());
代码示例来源:origin: lemire/javaewah
@Override
public AndIt clone() throws CloneNotSupportedException {
AndIt answer = (AndIt) super.clone();
answer.buffer = this.buffer.clone();
answer.ll = (LinkedList<IteratingRLW32>) this.ll.clone();
return answer;
}
代码示例来源:origin: lemire/javaewah
@Override
public BufferedAndIterator clone() throws CloneNotSupportedException {
BufferedAndIterator answer = (BufferedAndIterator) super.clone();
answer.buffer = this.buffer.clone();
answer.ll = (LinkedList<IteratingRLW>) this.ll.clone();
return answer;
}
代码示例来源:origin: org.fitnesse/fitnesse
public WikiPagePath copy() {
WikiPagePath clone = new WikiPagePath();
clone.names = (LinkedList<String>) names.clone();
clone.mode = mode;
return clone;
}
代码示例来源:origin: lemire/javaewah
@Override
public XORIt clone() throws CloneNotSupportedException {
XORIt answer = (XORIt) super.clone();
answer.buffer = this.buffer.clone();
answer.hardbitmap = this.hardBitmap.clone();
answer.ll = (LinkedList<IteratingRLW32>) this.ll.clone();
return answer;
}
代码示例来源:origin: lemire/javaewah
@Override
public BufferedXORIterator clone() throws CloneNotSupportedException {
BufferedXORIterator answer = (BufferedXORIterator) super
.clone();
answer.buffer = this.buffer.clone();
answer.hardbitmap = this.hardBitmap.clone();
answer.ll = (LinkedList<IteratingRLW>) this.ll.clone();
return answer;
}
代码示例来源:origin: lemire/javaewah
@Override
public BufferedXORIterator clone() throws CloneNotSupportedException {
BufferedXORIterator answer = (BufferedXORIterator) super.clone();
answer.buffer = this.buffer.clone();
answer.hardbitmap = this.hardbitmap.clone();
answer.ll = (LinkedList<IteratingRLW>) this.ll.clone();
return answer;
}
代码示例来源:origin: lemire/javaewah
@Override
public XORIt clone() throws CloneNotSupportedException {
XORIt answer = (XORIt) super.clone();
answer.buffer = this.buffer.clone();
answer.hardbitmap = this.hardbitmap.clone();
answer.ll = (LinkedList<IteratingRLW32>) this.ll.clone();
return answer;
}
代码示例来源:origin: com.googlecode.javaewah/JavaEWAH
@Override
public BufferedXORIterator clone() throws CloneNotSupportedException {
BufferedXORIterator answer = (BufferedXORIterator) super.clone();
answer.buffer = this.buffer.clone();
answer.hardbitmap = this.hardbitmap.clone();
answer.ll = (LinkedList<IteratingRLW>) this.ll.clone();
return answer;
}
内容来源于网络,如有侵权,请联系作者删除!