I was thinking if there exists a better/nicer way to negate an instanceof in Java. Actually, I\'m doing something like:
instanceof
if(!(str instanceof String))
ok just my two cents, use a is string method:
public static boolean isString(Object thing) { return thing instanceof String; } public void someMethod(Object thing){ if (!isString(thing)) { return null; } log.debug("my thing is valid"); }