Skip to content

Add Maps.toProperties #2040

@electrum

Description

@electrum

It would be helpful to have a method to convert a Map<String, String> to Properties to use when interacting with APIs that require it. For example, the JDBC Driver.connect() method takes a Properties.

public static Properties toProperties(Map<String, String> map) {
  Properties properties = new Properties();
  for (Map.Entry<String, String> entry : map.entrySet()) {
    properties.setProperty(entry.getKey(), entry.getValue());
  }
  return properties;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions