public static ClassNode lowestUpperBound ( List < ClassNode > nodes ) { if ( nodes . size ( ) == 1 ) return nodes . get ( 0 ) ; return lowestUpperBound ( nodes . get ( 0 ) , lowestUpperBound ( nodes . subList ( 1 , nodes . size ( ) ) ) ) ; }
Given a list of class nodes returns the first common supertype . For example Double and Float would return Number while Set and String would return Object .