io.vavr.collection.HashSet.toMap()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中io.vavr.collection.HashSet.toMap()方法的一些代码示例,展示了HashSet.toMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashSet.toMap()方法的具体详情如下:
包路径:io.vavr.collection.HashSet
类名称:HashSet
方法名:toMap

HashSet.toMap介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-pinot

static io.vavr.collection.Map<String, ?> loadConfigFromString(String string) {
 Config config =
   ConfigFactory.parseString(string, ConfigParseOptions.defaults().prependIncluder(new ConfigIncluder() {
    private ConfigIncluder parent = null;
    public ConfigObject include(ConfigIncludeContext context, String what) {
     return ConfigFactory.parseFileAnySyntax(new File(what)).root();
    }
    public ConfigIncluder withFallback(ConfigIncluder fallback) {
     parent = fallback;
     return this;
    }
   }));
 config = config.resolve();
 return HashSet.ofAll(config.entrySet()).toMap(entry -> Tuple.of(entry.getKey(), entry.getValue().unwrapped()));
}

代码示例来源:origin: apache/incubator-pinot

static io.vavr.collection.Map<String, ?> loadConfigFromFile(File file, String... profiles) {
 ConfigParseOptions options = ConfigParseOptions.defaults().prependIncluder(new ConfigIncluder() {
  private ConfigIncluder parent = null;
  public ConfigObject include(ConfigIncludeContext context, String what) {
   File file = new File(what);
   // Attempt to locate the file
   if (!file.exists()) {
    file = new File("profiles", what);
   }
   return ConfigFactory.parseFileAnySyntax(file).root();
  }
  public ConfigIncluder withFallback(ConfigIncluder fallback) {
   parent = fallback;
   return this;
  }
 });
 Config config = ConfigFactory.parseFile(file, options);
 // Load profiles
 for (String profile : profiles) {
  Config profileConfig = ConfigFactory.parseFile(new File("profiles", profile + ".conf"), options);
  config = config.withFallback(profileConfig);
 }
 config = config.resolve();
 config = processProfileConditionals(config, profiles);
 return HashSet.ofAll(config.entrySet()).toMap(entry -> Tuple.of(entry.getKey(), entry.getValue().unwrapped()));
}

代码示例来源:origin: apache/incubator-pinot

public static <T> T deserializeFromString(Class<T> clazz, String string) {
 Config config =
   ConfigFactory.parseString(string, ConfigParseOptions.defaults().prependIncluder(new ConfigIncluder() {
    private ConfigIncluder parent = null;
    public ConfigObject include(ConfigIncludeContext context, String what) {
     return ConfigFactory.parseFileAnySyntax(new File(what)).root();
    }
    public ConfigIncluder withFallback(ConfigIncluder fallback) {
     parent = fallback;
     return this;
    }
   }));
 config = config.resolve();
 try {
  return deserialize(clazz, io.vavr.collection.HashSet.ofAll(config.entrySet())
    .toMap(entry -> Tuple.of(entry.getKey(), entry.getValue().unwrapped())), "");
 } catch (Exception e) {
  Utils.rethrowException(e);
  return null;
 }
}

代码示例来源:origin: apache/incubator-pinot

HashSet.ofAll(config.entrySet()).toMap(entry -> Tuple.of(entry.getKey(), entry.getValue()));

代码示例来源:origin: resilience4j/resilience4j

@Test
public void testExportsCircuitBreakerStates() {
  // Given
  final CollectorRegistry registry = new CollectorRegistry();
  final Bulkhead bulkhead = Bulkhead.ofDefaults("foo");
  BulkheadExports.ofIterable("boo_bulkhead", singletonList(bulkhead)).register(registry);
  final Supplier<Map<String, Double>> values = () -> HashSet
      .of("available_concurrent_calls")
      .map(param ->
          Tuple.of(param, registry.getSampleValue(
              "boo_bulkhead",
              new String[]{"name", "param"},
              new String[]{"foo", param})))
      .toMap(t -> t);
  // When
  final Map<String, Double> initialValues = values.get();
  // Then
  assertThat(initialValues).isEqualTo(HashMap.of("available_concurrent_calls", 25.0));
}

代码示例来源:origin: resilience4j/resilience4j

@Test
public void testExportsRateLimiterMetrics() {
  // Given
  final CollectorRegistry registry = new CollectorRegistry();
  final RateLimiter rateLimiter = RateLimiter.ofDefaults("foo");
  RateLimiterExports.ofIterable("boo_rate_limiter", singletonList(rateLimiter)).register(registry);
  final Supplier<Map<String, Double>> values = () -> HashSet
      .of("available_permissions", "waiting_threads")
      .map(param ->
          Tuple.of(param, registry.getSampleValue(
              "boo_rate_limiter",
              new String[]{"name", "param"},
              new String[]{"foo", param})))
      .toMap(t -> t);
  // When
  final Map<String, Double> initialValues = values.get();
  // Then
  assertThat(initialValues).isEqualTo(HashMap.of(
      "available_permissions", 50.0,
      "waiting_threads", 0.0
  ));
}

代码示例来源:origin: resilience4j/resilience4j

new String[]{ "name", "state" },
    new String[]{ "foo", state})))
.toMap(t -> t);

代码示例来源:origin: resilience4j/resilience4j

new String[]{ "name", "call_result" },
        new String[]{ "foo", callType})))
.toMap(t -> t);

相关文章