public static String reverse(String self)Which we could simplify like this:
public static String reverse()Because self is not a real parameter when we use this method in the String class.
The Groovy String class reverse method just reverses the characters of a String and returns it to the caller. See below simple example:
println "rock".reverse()If we run this simple script, we will get below output
kcorIt is that simple as the documentation says that this method creates a new String which is the reverse (backwards) of this string. So in fact, this will return a new String with characters reversed. And also according to doc, this method has been implemented since Groovy version 1.8.2