@ SuppressWarnings ( "unchecked" ) public < T > List < T > getDevices ( final Class < T > type ) { final List < W1Device > allDevices = getDevices ( ) ; final List < T > filteredDevices = new ArrayList <> ( ) ; for ( final W1Device device : allDevices ) { if ( type . isAssignableFrom ( device . getClass ( ) ) ) { filteredDevices . add ( ( T ) device ) ; } } return filteredDevices ; }
Get a list of devices that implement a certain interface .