// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.grid.config;

import com.google.common.collect.ImmutableMap;

import java.util.AbstractMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

public class ConcatenatingConfig implements Config {

  private final Map<String, Object> values;

  public ConcatenatingConfig(Map<?, ?> values) {
    this.values = Objects.requireNonNull(values).entrySet().stream()
        .peek(entry -> Objects.requireNonNull(entry.getKey(), "Key has not been set"))
        .peek(entry -> Objects.requireNonNull(entry.getValue(), "Value has not been set"))
        .map(entry -> new AbstractMap.SimpleImmutableEntry<>(
            String.valueOf(entry.getKey()),
            String.valueOf(entry.getValue())))
        .collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, Map.Entry::getValue));
  }

  @Override
  public Optional<String> get(String section, String option) {
    return Optional.ofNullable(values.get(section + "." + option)).map(String::valueOf);
  }
}

@@ -1047,16 +1047,79 @@
 nfig %7B%0A%0A
+  private final String prefix;%0A  private final char separator;%0A
   privat
@@ -1138,22 +1138,22 @@
 String, 
-Object
+String
 %3E values
@@ -1188,27 +1188,151 @@
 fig(
-Map%3C?, ?%3E values) %7B
+String prefix, char separator, Map%3C?, ?%3E values) %7B%0A    this.prefix = prefix == null ? %22%22 : prefix + separator;%0A    this.separator = separator;%0A
 %0A   
@@ -1903,90 +1903,215 @@
     
-return Optional.ofNullable(values.get(section + %22.%22 + option)).map(String::valueOf
+String key = prefix + section + separator + option;%0A%0A    return values.entrySet().stream()%0A        .filter(entry -%3E key.equalsIgnoreCase(entry.getKey()))%0A        .map(Map.Entry::getValue)%0A        .findFirst(
 );%0A 

Make the concatenating config easier to use with properties.