The closest thing you can use for a "free-floating" function is a static function, which you can call qualified with a class name, for example.
public class Foo {
public static void bar(){}
}
... in the other place
Foo.bar();
You can add a little syntactic sugar to this to make it look what you think:
import static Foo.bar;
... in the other place
bar();
source
share