MCPcopy Create free account
hub / github.com/davidgiven/luje / checkType

Method checkType

lib/java/util/Collections.java:2681–2689  ·  view source on GitHub ↗

Checks if specified object is instance of specified class. Used for a dynamically typesafe view of the collections. @param obj - object is to be checked @param type - class of object that should be @return specified object

(E obj, Class<? extends E> type)

Source from the content-addressed store, hash-verified

2679 * @return specified object
2680 */
2681 static <E> E checkType(E obj, Class<? extends E> type) {
2682 if (obj != null && !type.isInstance(obj)) {
2683 // luni.05=Attempt to insert {0} element into collection with
2684 // element type {1}
2685 throw new ClassCastException(Messages.getString(
2686 "luni.05", obj.getClass(), type)); //$NON-NLS-1$
2687 }
2688 return obj;
2689 }
2690
2691 /**
2692 * Class represents a dynamically typesafe view of the specified collection.

Callers 10

addMethod · 0.80
addAllMethod · 0.80
setMethod · 0.80
addMethod · 0.80
addAllMethod · 0.80
setMethod · 0.80
addMethod · 0.80
putMethod · 0.80
putAllMethod · 0.80
setValueMethod · 0.80

Calls 3

getStringMethod · 0.95
isInstanceMethod · 0.80
getClassMethod · 0.80

Tested by

no test coverage detected