public static <T>T as(Class<T> type,Object o){
  if (type.isInstance(o)) {
    return type.cast(o);
  }
  return null;
}

public static < T > T as ( Class < T > type , Object o ) { if ( type . isInstance ( o ) ) { return type . cast ( o ) ; } return null ; }
emulate the as operator of c # . if the object can be cast to type it will be casted . if not this returns null .
