本文整理了Java中java.util.HashMap.clone()
方法的一些代码示例,展示了HashMap.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashMap.clone()
方法的具体详情如下:
包路径:java.util.HashMap
类名称:HashMap
方法名:clone
[英]Returns a shallow copy of this map.
[中]返回此贴图的浅层副本。
代码示例来源:origin: Netflix/zuul
/**
* Makes a copy of the RequestContext. This is used for debugging.
*
* @return
*/
@Override
public SessionContext clone()
{
return (SessionContext) super.clone();
}
代码示例来源:origin: Netflix/zuul
public ChannelConfig(HashMap<ChannelConfigKey, ChannelConfigValue> parameters)
{
this.parameters = (HashMap<ChannelConfigKey, ChannelConfigValue>) parameters.clone();
}
代码示例来源:origin: jersey/jersey
@Override
public OAuth1Parameters clone() {
return (OAuth1Parameters) super.clone();
}
}
代码示例来源:origin: wildfly/wildfly
private Node(String child_name, String fqn, Node parent, Map<String,Object> data) {
name=child_name;
this.fqn=fqn;
this.parent=parent;
if(data != null) this.data=(HashMap<String,Object>)((HashMap)data).clone();
}
代码示例来源:origin: robovm/robovm
/**
* Constructs an {@code Attributes} instance obtaining keys and values from
* the parameter {@code attrib}.
*
* @param attrib
* The attributes to obtain entries from.
*/
@SuppressWarnings("unchecked")
public Attributes(Attributes attrib) {
map = (Map<Object, Object>) ((HashMap) attrib.map).clone();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Copy constructor.
*/
@SuppressWarnings("unchecked")
private LinkedCaseInsensitiveMap(LinkedCaseInsensitiveMap<V> other) {
this.targetMap = (LinkedHashMap<String, V>) other.targetMap.clone();
this.caseInsensitiveKeys = (HashMap<String, String>) other.caseInsensitiveKeys.clone();
this.locale = other.locale;
}
代码示例来源:origin: apache/ignite
/**
* Returns a shallow copy of this {@code GridBoundedLinkedHashSet}
* instance: the elements themselves are not cloned.
*
* @return a shallow copy of this set.
* @throws CloneNotSupportedException Thrown if cloning is not supported.
*/
@Override public Object clone() throws CloneNotSupportedException {
GridBoundedLinkedHashSet<E> newSet = (GridBoundedLinkedHashSet<E>)super.clone();
newSet.map = (HashMap<E, Object>)map.clone();
return newSet;
}
}
代码示例来源:origin: robovm/robovm
@SuppressWarnings("unchecked")
@Override
public Object clone() {
Attributes clone;
try {
clone = (Attributes) super.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError(e);
}
clone.map = (Map<Object, Object>) ((HashMap) map).clone();
return clone;
}
代码示例来源:origin: Netflix/zuul
/**
* Makes a copy of the RequestContext. This is used for debugging.
*
* @return
*/
@Override
public SessionContext clone()
{
return (SessionContext) super.clone();
}
代码示例来源:origin: Netflix/zuul
public ChannelConfig(HashMap<ChannelConfigKey, ChannelConfigValue> parameters)
{
this.parameters = (HashMap<ChannelConfigKey, ChannelConfigValue>) parameters.clone();
}
代码示例来源:origin: org.springframework/spring-core
/**
* Copy constructor.
*/
@SuppressWarnings("unchecked")
private LinkedCaseInsensitiveMap(LinkedCaseInsensitiveMap<V> other) {
this.targetMap = (LinkedHashMap<String, V>) other.targetMap.clone();
this.caseInsensitiveKeys = (HashMap<String, String>) other.caseInsensitiveKeys.clone();
this.locale = other.locale;
}
代码示例来源:origin: quartz-scheduler/quartz
@Override
@SuppressWarnings("unchecked") // suppress warnings on generic cast of super.clone() and map.clone() lines.
public Object clone() {
DirtyFlagMap<K,V> copy;
try {
copy = (DirtyFlagMap<K,V>) super.clone();
if (map instanceof HashMap) {
copy.map = (Map<K,V>)((HashMap<K,V>)map).clone();
}
} catch (CloneNotSupportedException ex) {
throw new IncompatibleClassChangeError("Not Cloneable.");
}
return copy;
}
代码示例来源:origin: org.freemarker/freemarker
@Override
public Map getParameterMap() {
HashMap clone = (HashMap) paramsMap.clone();
for (Iterator it = clone.entrySet().iterator(); it.hasNext(); ) {
Map.Entry entry = (Map.Entry) it.next();
entry.setValue(((String[]) entry.getValue()).clone());
}
return Collections.unmodifiableMap(clone);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void cancel() {
if (mAnimatorMap.size() > 0) {
HashMap<Animator, PropertyBundle> mAnimatorMapCopy =
(HashMap<Animator, PropertyBundle>)mAnimatorMap.clone();
Set<Animator> animatorSet = mAnimatorMapCopy.keySet();
for (Animator runningAnim : animatorSet) {
runningAnim.cancel();
}
}
mPendingAnimations.clear();
View v = mView.get();
if (v != null) {
v.removeCallbacks(mAnimationStarter);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void cancel() {
if (mAnimatorMap.size() > 0) {
HashMap<Animator, PropertyBundle> mAnimatorMapCopy =
(HashMap<Animator, PropertyBundle>)mAnimatorMap.clone();
Set<Animator> animatorSet = mAnimatorMapCopy.keySet();
for (Animator runningAnim : animatorSet) {
runningAnim.cancel();
}
}
mPendingAnimations.clear();
View v = mView.get();
if (v != null) {
v.removeCallbacks(mAnimationStarter);
}
}
代码示例来源:origin: commons-collections/commons-collections
public boolean remove(Object o) {
if (fast) {
synchronized (FastHashMap.this) {
HashMap temp = (HashMap) map.clone();
boolean r = get(temp).remove(o);
map = temp;
return r;
}
} else {
synchronized (map) {
return get(map).remove(o);
}
}
}
代码示例来源:origin: commons-collections/commons-collections
public boolean removeAll(Collection o) {
if (fast) {
synchronized (FastHashMap.this) {
HashMap temp = (HashMap) map.clone();
boolean r = get(temp).removeAll(o);
map = temp;
return r;
}
} else {
synchronized (map) {
return get(map).removeAll(o);
}
}
}
代码示例来源:origin: commons-collections/commons-collections
public boolean retainAll(Collection o) {
if (fast) {
synchronized (FastHashMap.this) {
HashMap temp = (HashMap) map.clone();
boolean r = get(temp).retainAll(o);
map = temp;
return r;
}
} else {
synchronized (map) {
return get(map).retainAll(o);
}
}
}
代码示例来源:origin: googlemaps/android-maps-utils
@SuppressWarnings("unchecked")
@Override
public BiMultiMap<K> clone() {
BiMultiMap<K> cloned = new BiMultiMap<>();
cloned.putAll((Map<K, Object>) super.clone());
return cloned;
}
代码示例来源:origin: ethereum/ethereumj
@Override
public ContractDetails clone() {
ContractDetailsCacheImpl contractDetails = new ContractDetailsCacheImpl(origContract);
Object storageClone = ((HashMap<DataWord, DataWord>)storage).clone();
contractDetails.setCode(this.getCode());
contractDetails.setStorage( (HashMap<DataWord, DataWord>) storageClone);
return contractDetails;
}
内容来源于网络,如有侵权,请联系作者删除!