check for null before or after casting
The first snippet runs on any type returned by result.get, the second snippet needs the method to return a String. So it makes only sense to compare the snippets if result.get returns  a String. I assume so.

The type cast is a noOp in byte code. So the real difference is that the first snippet calls name.toString(), but the second uses name directly. The result is the same but the method call may be slower than the direct access to name. 

If the first is really slower depends on the optimizing that will be done by the compiler and runtime environment. You should benchmark it with the version of java currently in use, if you are interested in the result.