public static Object findValueOfType(Collection collection,Class type){
  if (isEmpty(collection)) {
    return null;
  }
  Object value=null;
  for (Iterator it=collection.iterator(); it.hasNext(); ) {
    Object obj=it.next();
    if (type == null || type.isInstance(obj)) {
      if (value != null) {
        return null;
      }
      value=obj;
    }
  }
  return value;
}

public static Object findValueOfType ( Collection collection , Class type ) { if ( isEmpty ( collection ) ) { return null ; } Object value = null ; for ( Iterator it = collection . iterator ( ) ; it . hasNext ( ) ; ) { Object obj = it . next ( ) ; if ( type == null || type . isInstance ( obj ) ) { if ( value != null ) { return null ; } value = obj ; } } return value ; }
find a single value of the given type in the given collection .
