×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Gerrit Viljoen
Added: Jul 30, 2014 12:44 PM
Views: 17
Same functionality as the other instanceOf.
  1.     public static boolean instanceOf(Object object, Class clazz) {
  2.         if (object == null) {
  3.             return true;
  4.         } else if (clazz == null) {
  5.             return false;
  6.         } else {
  7.             return clazz.isAssignableFrom(object.getClass());
  8.         }
  9.     }