meilisearch-java icon indicating copy to clipboard operation
meilisearch-java copied to clipboard

- use varargs instead of string arrays

Open singlyfy opened this issue 1 year ago • 3 comments

Pull Request

What does this PR do?

it replaces String[] arguments with varargs (String ... foo). It simplifies method calls and it should be backwards compatible. NOTE:
This pull requests only changes method signature, additional validation should be added in places where at least one value is needed.

singlyfy avatar Oct 01 '23 14:10 singlyfy

@singlyfy thanks for the PR Can you fix the tests (integration/unit tests)? cf the CI

Also, is this PR breaking for the users? I really ask, I don't necessarily refuse breaking PRs since the library is not stable yet, if it improves the user experience. I'm not a Java developer, that's why I ask.

curquiza avatar Oct 12 '23 08:10 curquiza

String[] arguments with varargs (String ... foo)

The change should not be breaking @curquiza I tried this sample:

import java.util.Arrays;

public class MyClass {
    public static void main(String args[]) {
      opa("opa", "123");
      opa(new String[] {"opa","data"});
    }
    
    public static void opa(String... arg) {
        System.out.println(Arrays.toString(arg));
    }
}

and compiled + execute nicely! (java 8)

brunoocasali avatar Oct 17 '23 16:10 brunoocasali

Thank you @brunoocasali

Still needs @singlyfy to fix the tests and we are good

curquiza avatar Oct 17 '23 17:10 curquiza