当前位置: 首页>>代码示例>>Java>>正文


Java HashSet.ofAll方法代码示例

本文整理汇总了Java中io.vavr.collection.HashSet.ofAll方法的典型用法代码示例。如果您正苦于以下问题:Java HashSet.ofAll方法的具体用法?Java HashSet.ofAll怎么用?Java HashSet.ofAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vavr.collection.HashSet的用法示例。


在下文中一共展示了HashSet.ofAll方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
@PostConstruct
public void init() {

  // start with our preset list...
  Set<Ticker> tickersAll = HashSet.ofAll(TurbineFuelConstants.PRESET_TICKERS);

  // get any tickers from elasticsearch...
  List<Ticker> tickersFromEs = elasticsearch.findTickersByExchange(ExchangeEnum.LSE);
  // tickers.forEach(t -> logger.info(t.toString()));

  // NOTE: this doesn't trap uncheck exceptions...
  // List<Ticker> tickersFromEs = Try.of(() -> elasticsearch.findTickersByExchange(ExchangeEnum.LSE)).getOrElse(new
  // ArrayList<Ticker>());

  // TODO better way to do this with Option?
  if (tickersFromEs == null || tickersFromEs.isEmpty()) {
    logger.warn("WARNING: no tickers found in elasticsearch, only our hardcoded watches will be available to start with: {}",
        TurbineFuelConstants.PRESET_TICKERS);
  } else {
    tickersAll = TurbineFuelConstants.PRESET_TICKERS.addAll(tickersFromEs);
  }

  // create realtime simulations of watches and/or tickers from elasticsearch...
  tickersAll
      // restrict to only preset tickers for now...
      .filter(tick -> TurbineFuelConstants.PRESET_TICKERS.contains(tick))
      .map(tick -> findOrCreateTickProducer(tick))
      .forEach(producer -> producers = producers.add(producer));
}
 
开发者ID:the-james-burton,项目名称:the-turbine,代码行数:30,代码来源:ProducerManager.java

示例2: init

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
@PostConstruct
public void init() {
  // turbineIndicators.addAll(turbineService.findIndicators());
  turbineIndicators.addAll(turbineService.getIndicatorInstances());
  turbineStrategies.addAll(turbineService.findStrategies());

  // environment.getActiveProfiles();

  // TODO temporary...!!!
  // if (true)
  // return;

  List<Ticker> tickersFromEs = elasticsearch.findTickersByExchange(ExchangeEnum.LSE);
  if (tickersFromEs == null || tickersFromEs.isEmpty()) {
    logger.warn(" !!!! WARNING ---- no tickers found in elasticsearch ---- !!!!");
  } else {
    tickers = HashSet.ofAll(tickersFromEs);
  }
  stocks = tickers.map(t -> Stock.of(t, turbineIndicators, turbineStrategies));
  List<String> rics = tickers.map(ticker -> ticker.getRicAsString()).toJavaList();
  logger.info("setting up for {} tickers : {}", rics.size(), rics);

  // recover the history...
  stocks
      .map(stock -> Tuple.of(stock,
          Option.of(elasticsearch.findTicksByRic(stock.getTicker().getRicAsString())).getOrElse(new ArrayList<>())))
      .peek(tuple -> logger.info("recovering:{}:{}", tuple._1, tuple._2.size()))
      .filter(tuple -> !tuple._2.isEmpty())
      .forEach(tuple -> tuple._1.recoverTicks(tuple._2));

}
 
开发者ID:the-james-burton,项目名称:the-turbine,代码行数:32,代码来源:TickerManager.java

示例3: create

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
Set<?> create(List<Object> result, DeserializationContext ctx) throws JsonMappingException {
    if (io.vavr.collection.SortedSet.class.isAssignableFrom(javaType.getRawClass())) {
        checkContainedTypeIsComparable(ctx, javaType.containedTypeOrUnknown(0));
        return io.vavr.collection.TreeSet.ofAll((Comparator<Object> & Serializable) (o1, o2) -> ((Comparable) o1).compareTo(o2), result);
    }
    if (io.vavr.collection.LinkedHashSet.class.isAssignableFrom(javaType.getRawClass())) {
        return io.vavr.collection.LinkedHashSet.ofAll(result);
    }
    // default deserialization [...] -> Set
    return HashSet.ofAll(result);
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:14,代码来源:SetDeserializer.java

示例4: build

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
@Override
public Set<?> build() {
    return HashSet.ofAll(list);
}
 
开发者ID:dropwizard,项目名称:dropwizard-vavr,代码行数:5,代码来源:SetContainerFactory.java

示例5: of

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
@Override
HashSet<?> of(Object... arr) {
    return HashSet.ofAll(Arrays.asList(arr));
}
 
开发者ID:vavr-io,项目名称:vavr-gson,代码行数:5,代码来源:HashSetTest.java

示例6: anySubTag

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
/**
 * Matches a tag or (grant)child tag with the given name(s), emitting all tha events that make up that tag and its content.
 */
public static SelectedSubTagProtocol anySubTag(Iterable<QName> names) {
    return new SelectedSubTagProtocol(HashSet.ofAll(names));
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:7,代码来源:XMLProtocol.java

示例7: keySet

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
@Override
public Set<DatabaseKey> keySet() {
  return HashSet.ofAll(cache.keySet());
}
 
开发者ID:tonivade,项目名称:claudb,代码行数:5,代码来源:OnHeapDatabase.java

示例8: widen

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
public static <T> HashSetKind<T> widen(final Publisher<T> completableSet) {

        return new HashSetKind<>(
                                HashSet.ofAll((Iterable<T>)ReactiveSeq.fromPublisher(completableSet)));
    }
 
开发者ID:aol,项目名称:cyclops,代码行数:6,代码来源:HashSetKind.java

示例9: of

import io.vavr.collection.HashSet; //导入方法依赖的package包/类
@Override
protected Set<?> of(Object... objects) {
    return HashSet.ofAll(Arrays.asList(objects));
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:5,代码来源:HashSetTest.java


注:本文中的io.vavr.collection.HashSet.ofAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。