You need to sign in to do that
Don't have an account?
Alex Tsitsura
Variable number of arguments for a method?
Hi,
It is possible to declare a method that will allow a variable number of parameters?
Java example:
void foo(String... args) {
for (String arg : args) {
System.out.println(arg);
}
}
It is possible to declare a method that will allow a variable number of parameters?
Java example:
void foo(String... args) {
for (String arg : args) {
System.out.println(arg);
}
}
For this you can use List<> to accept X number of arguments of the same type: https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_collections_lists.htm
So in this case you can use List<Object> - this argument can accept any String/Account/Contact etc reference data type variable