If number of parameters is dynamic, you can use double brace initialization:
public static void main(final String[] args) {
method(new HashMap<String, Object>(){{
put("p1", new Object());
put("p2", new Object());
}});
}
private static void method(Map<String, Object> params){
}
It has some drawbacks, but still viable approach. Be careful every call site will have it's own anonymous class. There also might be some problems with type safety. Instead of String-based keys, you can use enums. Instead of Map any custom type could be used, Map just is the most common. DBI is more useful then varargs in case of dynamic parameters length.