本文整理了Java中java.util.Collections.checkType()
方法的一些代码示例,展示了Collections.checkType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collections.checkType()
方法的具体详情如下:
包路径:java.util.Collections
类名称:Collections
方法名:checkType
[英]Checks if specified object is instance of specified class. Used for a dynamically typesafe view of the collections.
[中]检查指定对象是否为指定类的实例。用于集合的动态类型安全视图。
代码示例来源:origin: robovm/robovm
@Override public V put(K key, V value) {
return m.put(checkType(key, keyType), checkType(value, valueType));
}
代码示例来源:origin: robovm/robovm
@Override public boolean add(E obj) {
return c.add(checkType(obj, type));
}
代码示例来源:origin: robovm/robovm
@Override public void set(E obj) {
i.set(checkType(obj, type));
}
代码示例来源:origin: robovm/robovm
@Override public void add(int index, E obj) {
l.add(index, checkType(obj, type));
}
代码示例来源:origin: robovm/robovm
@Override public void add(E obj) {
i.add(checkType(obj, type));
}
}
代码示例来源:origin: robovm/robovm
@Override public E set(int index, E obj) {
return l.set(index, checkType(obj, type));
}
代码示例来源:origin: robovm/robovm
@Override public V setValue(V obj) {
return e.setValue(checkType(obj, valueType));
}
代码示例来源:origin: robovm/robovm
@SuppressWarnings("unchecked")
@Override public boolean addAll(Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return c.addAll((List<E>) Arrays.asList(array));
}
代码示例来源:origin: robovm/robovm
@SuppressWarnings("unchecked")
@Override public boolean addAll(int index, Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return l.addAll(index, (List<E>) Arrays.asList(array));
}
代码示例来源:origin: robovm/robovm
@SuppressWarnings("unchecked")
@Override public void putAll(Map<? extends K, ? extends V> map) {
int size = map.size();
if (size == 0) {
return;
}
Map.Entry<? extends K, ? extends V>[] entries = new Map.Entry[size];
Iterator<? extends Map.Entry<? extends K, ? extends V>> it = map
.entrySet().iterator();
for (int i = 0; i < size; i++) {
Map.Entry<? extends K, ? extends V> e = it.next();
checkType(e.getKey(), keyType);
checkType(e.getValue(), valueType);
entries[i] = e;
}
for (int i = 0; i < size; i++) {
m.put(entries[i].getKey(), entries[i].getValue());
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
@Override public void add(E obj) {
i.add(checkType(obj, type));
}
}
代码示例来源:origin: MobiVM/robovm
@Override public E set(int index, E obj) {
return l.set(index, checkType(obj, type));
}
代码示例来源:origin: ibinti/bugvm
@SuppressWarnings("unchecked")
@Override public boolean addAll(int index, Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return l.addAll(index, (List<E>) Arrays.asList(array));
}
代码示例来源:origin: MobiVM/robovm
@SuppressWarnings("unchecked")
@Override public boolean addAll(Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return c.addAll((List<E>) Arrays.asList(array));
}
代码示例来源:origin: ibinti/bugvm
@SuppressWarnings("unchecked")
@Override public boolean addAll(Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return c.addAll((List<E>) Arrays.asList(array));
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
@SuppressWarnings("unchecked")
@Override public boolean addAll(int index, Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return l.addAll(index, (List<E>) Arrays.asList(array));
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
@SuppressWarnings("unchecked")
@Override public boolean addAll(Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return c.addAll((List<E>) Arrays.asList(array));
}
代码示例来源:origin: com.bugvm/bugvm-rt
@SuppressWarnings("unchecked")
@Override public boolean addAll(int index, Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return l.addAll(index, (List<E>) Arrays.asList(array));
}
代码示例来源:origin: com.jtransc/jtransc-rt
@SuppressWarnings("unchecked")
@Override public boolean addAll(int index, Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return l.addAll(index, (List<E>) Arrays.asList(array));
}
代码示例来源:origin: MobiVM/robovm
@SuppressWarnings("unchecked")
@Override public boolean addAll(int index, Collection<? extends E> c1) {
Object[] array = c1.toArray();
for (Object o : array) {
checkType(o, type);
}
return l.addAll(index, (List<E>) Arrays.asList(array));
}
内容来源于网络,如有侵权,请联系作者删除!