public
Created

  • Download Gist
mypkg/Ugly.java
Java
1 2 3 4 5 6 7
package mypkg;
 
public class Ugly {
public Ugly(){}
public String foo(boolean i) { return "bool: " + i; }
public String foo(Object o) { return "obj: " + o; }
}
use-ugly.clj
Clojure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
(.foo (mypkg.Ugly.) 5)
;=> "obj: 5"
 
(.foo (mypkg.Ugly.) true)
;=> "obj: true"
 
(.foo (mypkg.Ugly.) (boolean true))
;=> "bool: true"
 
 
(def u (mypkg.Ugly.))
(.foo u (boolean true))
;=> "obj: true"
 
(.foo #^mypkg.Ugly u (boolean true))
;=> "bool: true"

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.