java.util.LinkedHashSet.clone()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中java.util.LinkedHashSet.clone()方法的一些代码示例,展示了LinkedHashSet.clone()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedHashSet.clone()方法的具体详情如下:
包路径:java.util.LinkedHashSet
类名称:LinkedHashSet
方法名:clone

LinkedHashSet.clone介绍

暂无

代码示例

代码示例来源:origin: org.antlr/antlr4-runtime

@Override
public Object clone() {
  @SuppressWarnings("unchecked") // safe (result of clone)
  OrderedHashSet<T> dup = (OrderedHashSet<T>)super.clone();
  dup.elements = new ArrayList<T>(this.elements);
  return dup;
}

代码示例来源:origin: geotools/geotools

/**
   * Returns a shallow copy of this set.
   *
   * @return A shallow copy of this set.
   */
  @Override
  @SuppressWarnings("unchecked")
  public CheckedHashSet<E> clone() {
    synchronized (getLock()) {
      return (CheckedHashSet) super.clone();
    }
  }
}

代码示例来源:origin: org.everit.osgi/org.everit.osgi.ecm.component.ri

/**
 * Returns a clone of the held service registrations.
 *
 * @return A clone of the service registrations of the component.
 */
public synchronized Set<ServiceRegistration<?>> getCloneOfServiceRegistrations() {
 @SuppressWarnings("unchecked")
 Set<ServiceRegistration<?>> result = (Set<ServiceRegistration<?>>) serviceRegistrations
   .clone();
 return result;
}

代码示例来源:origin: nl.jqno.equalsverifier/equalsverifier

protected LinkedHashSet<TypeTag> cloneWith(LinkedHashSet<TypeTag> typeStack, TypeTag tag) {
  @SuppressWarnings("unchecked")
  LinkedHashSet<TypeTag> clone = (LinkedHashSet<TypeTag>)typeStack.clone();
  clone.add(tag);
  return clone;
}

代码示例来源:origin: jqno/equalsverifier

protected LinkedHashSet<TypeTag> cloneWith(LinkedHashSet<TypeTag> typeStack, TypeTag tag) {
  @SuppressWarnings("unchecked")
  LinkedHashSet<TypeTag> clone = (LinkedHashSet<TypeTag>)typeStack.clone();
  clone.add(tag);
  return clone;
}

代码示例来源:origin: uk.co.nichesolutions/antlr4-runtime

@Override
public Object clone() {
  @SuppressWarnings("unchecked") // safe (result of clone)
  OrderedHashSet<T> dup = (OrderedHashSet<T>)super.clone();
  dup.elements = new ArrayList<T>(this.elements);
  return dup;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

@Override
public Object clone() {
  @SuppressWarnings("unchecked") // safe (result of clone)
  OrderedHashSet<T> dup = (OrderedHashSet<T>)super.clone();
  dup.elements = new ArrayList<T>(this.elements);
  return dup;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
public Object clone() {
  @SuppressWarnings("unchecked") // safe (result of clone)
  OrderedHashSet<T> dup = (OrderedHashSet<T>)super.clone();
  dup.elements = new ArrayList<T>(this.elements);
  return dup;
}

代码示例来源:origin: com.tunnelvisionlabs/antlr4-runtime

@Override
public Object clone() {
  @SuppressWarnings("unchecked") // safe (result of clone)
  OrderedHashSet<T> dup = (OrderedHashSet<T>)super.clone();
  dup.elements = new ArrayList<T>(this.elements);
  return dup;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

@SuppressWarnings("unchecked")
public ScoreData cloneAsThawed() {
  try {
    ScoreData result = (ScoreData) clone();
    result.scores = (LinkedHashSet<R3<LocalePatternMatcher, LocalePatternMatcher, Double>>) result.scores.clone();
    result.frozen = false;
    return result;
  } catch (CloneNotSupportedException e) {
    throw new ICUCloneNotSupportedException(e); // will never happen
  }
}

代码示例来源:origin: jpox/jpox

/**
 * Creates and returns a copy of this object.
 * @return The cloned object
 */
public Object clone()
{
  if (useCache)
  {
    loadFromStore();
  }
  return delegate.clone();
}

代码示例来源:origin: edu.stanford.protege/jpaul

public Set<E> newColl(Collection<E> c) {
  if(c instanceof LinkedHashSet/*<E>*/) {
  @SuppressWarnings("unchecked")
  Set<E> result = (Set<E>) ((LinkedHashSet<E>) c).clone();
  return result;
  }
  else {
  return super.newColl(c);
  }
}
}

代码示例来源:origin: org.geotools/gt-metadata

/**
   * Returns a shallow copy of this set.
   *
   * @return A shallow copy of this set.
   */
  @Override
  @SuppressWarnings("unchecked")
  public CheckedHashSet<E> clone() {
    synchronized (getLock()) {
      return (CheckedHashSet) super.clone();
    }
  }
}

代码示例来源:origin: it.unibo.alice.tuprolog/tuprolog

@Override         
public Object clone() {		 
  OperatorRegister or = (OperatorRegister)super.clone();		 
  Iterator<Operator> ior = or.iterator();         
  or.nameTypeToKey = new HashMap<String, Operator>();		 
  while(ior.hasNext()) {		 
    Operator o = ior.next();         
    or.nameTypeToKey.put(o.name + o.type, o);         
  }         
  return or;
}
/**/

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

@Override
public Object clone() {
  if (isDirectAccess()) {
    return super.clone();
  }
  if (isDelayLoad()) {
    load();
  }
  Proxy localProxy = (Proxy) super.clone();
  localProxy.setOwner(null, 0);
  return localProxy;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

@Override
public Object clone() {
  if (isDirectAccess()) {
    return super.clone();
  }
  if (isDelayLoad()) {
    load();
  }
  Proxy localProxy = (Proxy) super.clone();
  localProxy.setOwner(null, 0);
  return localProxy;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

@Override
public Object clone() {
  if (isDirectAccess()) {
    return super.clone();
  }
  if (isDelayLoad()) {
    load();
  }
  Proxy localProxy = (Proxy) super.clone();
  localProxy.setOwner(null, 0);
  return localProxy;
}

代码示例来源:origin: org.jboss.cache/jbosscache-core

@SuppressWarnings("unchecked")
private static <T extends Collection> T attemptKnownSetCopy(T set)
{
 if (set instanceof LinkedHashSet)
   return (T) ((LinkedHashSet) set).clone();
 if (set instanceof HashSet)
   return (T) ((HashSet) set).clone();
 if (set instanceof TreeSet)
   return (T) ((TreeSet) set).clone();
 return null;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

@Override
public Object clone() {
  if (isDirectAccess()) {
    return super.clone();
  }
  if (isDelayLoad()) {
    load();
  }
  Proxy localProxy = (Proxy) super.clone();
  localProxy.setOwner(null, 0);
  return localProxy;
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/apiconsumer-activity-ui

@Override
public void noteConfiguration() {
  ApiConsumerActivityConfigurationBean newConfiguration = (ApiConsumerActivityConfigurationBean) cloneBean(configuration);
  newConfiguration.setClassLoaderSharing(newClassLoaderSharing);
  newConfiguration.setLocalDependencies((LinkedHashSet<String>) newLocalDependencies.clone());
  newConfiguration.setArtifactDependencies(new LinkedHashSet<BasicArtifact>());
  configuration = newConfiguration;
}

相关文章