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

refactor: Replace private usages of Guava Collections API with Java Collections API #2136

Conversation

valfirst
Copy link
Collaborator

Change list

Public API based on Guava Collections API is not changed (it's already deprecated):

/**
* Prepares single argument.
*
* @param param is a parameter name.
* @param value is the parameter value.
* @return built {@link ImmutableMap}.
* @deprecated Use {@link Map#of(Object, Object)}
*/
@Deprecated
public static ImmutableMap<String, Object> prepareArguments(String param,
Object value) {
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
builder.put(param, value);
return builder.build();
}
/**
* Prepares collection of arguments.
*
* @param params is the array with parameter names.
* @param values is the array with parameter values.
* @return built {@link ImmutableMap}.
* @deprecated Use {@link Map#of(Object, Object, Object, Object)}
*/
@Deprecated
public static ImmutableMap<String, Object> prepareArguments(String[] params,
Object[] values) {
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
for (int i = 0; i < params.length; i++) {
if (!isNullOrEmpty(params[i]) && values[i] != null) {
builder.put(params[i], values[i]);
}
}
return builder.build();
}

Types of changes

What types of changes are you proposing/introducing to Java client?
Put an x in the boxes that apply

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

.put("appPath", appPath)
.putAll(Optional.ofNullable(options).map(BaseOptions::build).orElseGet(Collections::emptyMap))
.build();
Map<String, Object> args = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to use var

@valfirst valfirst merged commit 75e7262 into appium:master Mar 26, 2024
5 checks passed
@valfirst valfirst deleted the replace-private-usages-of-guava-collections-with-java-collections branch March 26, 2024 19:20
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