public static < T > Optional < T > findFirst ( Class < T > clazz ) { ServiceLoader < T > load = ServiceLoader . load ( clazz ) ; return StreamSupport . stream ( load . spliterator ( ) , false ) . findFirst ( ) ; }
Finds the first implementation of the given service type and creates its instance .