public static < E > Collection < E > get ( Class < ? extends E > service ) { Iterator < ? extends E > implementations = ServiceLoader . load ( service ) . iterator ( ) ; Collection < E > result = new ArrayList < E > ( ) ; while ( implementations . hasNext ( ) ) { result . add ( implementations . next ( ) ) ; } return result ; }
Lookup implementations of the supplied SPI . Please note that the order in which the implementations will occur in the collection is not specified .