Component.getBehaviors() is implemented as
but can be
As mentioned in getBehaviors(Class type) documentation: "The type or null for all". The handling code in Behaviors.getBehaviors method is following:
if (obj != null && obj instanceof Behavior)
if (type == null || type.isAssignableFrom(obj.getClass()))
When called with "null" parameter, only the first condition of inner "if" is tested. If called with Behavior.class, all conditions has to be evaluated and you call "obj instanceof Behavior" twice in fact (because "Behavior.class.isAssignableFrom(obj.getClass())" is equivalent to "obj instanceof Behavior").