Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add builder method that accepts iterable #350

Merged
merged 1 commit into from
Nov 21, 2020

Conversation

wheelerlaw
Copy link
Contributor

This lets me do something like this:

JsonSchemaFactory factory = JsonSchemaFactory.builder(JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7))
            .uriFetcher(new JenkinsWorkspaceFileFetcher(), JenkinsWorkspaceFileFetcher.SUPPORTED_SCHEMES)

JenkinsWorkspaceFileFetcher.SUPPORTED_SCHEMES is a Set<String>, which can't be passed into varargs. But varargs can be passed into an Iterable<String> if you wrap it with Arrays.asList(varargs), and it is cheap too since an ArrayList<> is just backed by an array.

@stevehu stevehu merged commit 0d442fd into networknt:master Nov 21, 2020
@stevehu
Copy link
Contributor

stevehu commented Nov 21, 2020

@wheelerlaw It makes perfect sense. Thanks a lot for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants