How to pass a UDF function with two arguments to mapPartitions in Java Spark?

I have the following method that takes two arguments (Iterable<A> and Object Lexicon) and returns a UseCase object. How should I call createUseCaseMatcher inside mapPartitions to apply it to a JavaRDD<A> ?