static protected Map<String, Object> getReadOnlyQueryParameters(Map<String, Object> queryParams)
  {
    try
    {
      Map<String, Object> readOnlyCopy = new HashMap<>
          (CollectionUtils.getMapInitialCapacity(queryParams.size(), 0.75f), 0.75f);
      for (Map.Entry<String, Object> entry: queryParams.entrySet())
      {
        String key = entry.getKey();
        Object value = entry.getValue();
        readOnlyCopy.put(key, getReadOnlyJavaObject(value));
      }

      return Collections.unmodifiableMap(readOnlyCopy);
    }
    catch (CloneNotSupportedException cloneException)
    {
      throw new IllegalArgumentException("Query parameters cannot be cloned.", cloneException);
    }
  }
@Test
  public void testQueryParameterCopyPreservesSetOrder()
  {
    // Experimentally, this order of inputs into LinkedHashSet will be different
    // when copied into a HashSet and iterated over. This _is_ subject to change
    // as the JDK changes, so this is a best effort test only.
    LinkedHashSet<String> initialSetParameter = new LinkedHashSet<>(Arrays.asList("4", "3", "2", "1"));

    Map<String, Object> initialQueryParameters = new HashMap<>();
    initialQueryParameters.put("set", initialSetParameter);

    Map<String, Object> readOnlyQueryParameters =
        AbstractRequestBuilder.getReadOnlyQueryParameters(initialQueryParameters);

    @SuppressWarnings("unchecked")
    List<String> orderedReadOnlySetParameter = new ArrayList<>((Set<String>) readOnlyQueryParameters.get("set"));

    Assert.assertEquals(orderedReadOnlySetParameter, new ArrayList<>(initialSetParameter));
  }