src/main/java/org/fit/layout/api/ServiceManager.java
public static <T> T findByClass(Collection<?> services, Class<T> clazz)
    {
        for (Object serv : services)
        {
            if (clazz.isInstance(serv))
                return clazz.cast(serv);
        }
        return null;
    }
public static <T> T findByClass(Collection<?> services, Class<T> clazz)
    {
        for (Object serv : services)
        {
            if (clazz.isInstance(serv))
                return clazz.cast(serv);
        }
        return null;
    }
public static < T > T findByClass ( Collection < ? > services , Class < T > clazz ) { for ( Object serv : services ) { if ( clazz . isInstance ( serv ) ) return clazz . cast ( serv ) ; } return null ; }
Finds a service in a collection of services based on its class.
@param services the collection of services to scan
@param clazz the required class of the service
@return the fisrt service in the collection that is instance of the given class or {@code null} when
no such servise is present in the collection.
Finds a service in a collection of services based on its class .