question: public boolean implementsInterface ( ReferenceBinding anInterface , boolean searchHierarchy ) { if ( this == anInterface ) return true ; ReferenceBinding [ ] interfacesToVisit = null ; int nextPosition = 0 ; ReferenceBinding currentType = this ; do { ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != null && itsInterfaces != Binding . NO_SUPERINTERFACES ) { if ( interfacesToVisit == null ) { interfacesToVisit = itsInterfaces ; nextPosition = interfacesToVisit . length ; } else { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , 0 , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + 5 ] , 0 , nextPosition ) ; nextInterface : for ( int a = 0 ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = 0 ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } } while ( searchHierarchy && ( currentType = currentType . superclass ( ) ) != null ) ; for ( int i = 0 ; i < nextPosition ; i ++ ) { currentType = interfacesToVisit [ i ] ; if ( currentType . isEquivalentTo ( anInterface ) ) return true ; ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != null && itsInterfaces != Binding . NO_SUPERINTERFACES ) { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , 0 , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + 5 ] , 0 , nextPosition ) ; nextInterface : for ( int a = 0 ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = 0 ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } return false ; }
target:  Answer true if the receiver implements anInterface or is identical to anInterface. If searchHierarchy is true, then also search the receiver's superclasses. <p/> NOTE: Assume that anInterface is an interface.