public static boolean isUniformCollection(Collection<?> c,Class<?> e){
  if (e == null) {
    throw new IllegalArgumentException("Null reference type");
  }
  if (c == null) {
    throw new IllegalArgumentException("Null collection");
  }
  if (c.isEmpty()) {
    return false;
  }
  for (  Object o : c) {
    if (o == null || !e.isAssignableFrom(o.getClass())) {
      return false;
    }
  }
  return true;
}

public static boolean isUniformCollection ( Collection < ? > c , Class < ? > e ) { if ( e == null ) { throw new IllegalArgumentException ( "Null reference type" ) ; } if ( c == null ) { throw new IllegalArgumentException ( "Null collection" ) ; } if ( c . isEmpty ( ) ) { return false ; } for ( Object o : c ) { if ( o == null || ! e . isAssignableFrom ( o . getClass ( ) ) ) { return false ; } } return true ; }
check if the given collection is a uniform collection of the given type .
