code: private <T> Map<String, T> getCache(Map<String, T> userCache, Map<String, T> autoCache,
      boolean includeUserDefined, boolean includeAutoGenerated) {
      Map<String, T> cache = new HashMap<>();
      if (includeUserDefined) {
        cache.putAll(userCache);
      }
      if (includeAutoGenerated) {
        cache.putAll(autoCache);
      }
      return Collections.unmodifiableMap(cache);
    }
docs: Creates a cache containing a mapping from variables to query elements. The cache is filled
  with elements from the user cache and/or the auto cache depending on the specified flags.
  
  @param userCache element user cache
  @param autoCache element auto cache
  @param includeUserDefined true, iff user cache elements shall be included
  @param includeAutoGenerated true, iff auto cache elements shall be included
  @param <T> query element type
  @return immutable cache