java.util.Arrays.setAll()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(435)

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

Arrays.setAll介绍

暂无

代码示例

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

private AggregatorFactory[] getCombiningFactories(AggregatorFactory[] aggregatorFactories)
 {
  final AggregatorFactory[] combiningFactories = new AggregatorFactory[aggregatorFactories.length];
  Arrays.setAll(combiningFactories, i -> aggregatorFactories[i].getCombiningFactory());
  return combiningFactories;
 }
}

代码示例来源:origin: prestodb/presto

public Page getPositions(int[] retainedPositions, int offset, int length)
{
  requireNonNull(retainedPositions, "retainedPositions is null");
  Block[] blocks = new Block[this.blocks.length];
  Arrays.setAll(blocks, i -> this.blocks[i].getPositions(retainedPositions, offset, length));
  return new Page(length, blocks);
}

代码示例来源:origin: prestodb/presto

public Page getPositions(int[] retainedPositions, int offset, int length)
{
  requireNonNull(retainedPositions, "retainedPositions is null");
  Block[] blocks = new Block[this.blocks.length];
  Arrays.setAll(blocks, i -> this.blocks[i].getPositions(retainedPositions, offset, length));
  return new Page(length, blocks);
}

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

private EventPublisher[] initializePublisherThreads(int publisherThreadCount,
                          Executor executor,
                          TransactionManager transactionManager,
                          RollbackConfiguration rollbackConfiguration) {
  EventPublisher[] publishers = new EventPublisher[publisherThreadCount];
  Arrays.setAll(publishers, t -> new EventPublisher(executor, transactionManager, rollbackConfiguration, t));
  return publishers;
}

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

private CommandHandlerInvoker[] initializeInvokerThreads(int invokerThreadCount, Cache cache) {
  CommandHandlerInvoker[] invokers = new CommandHandlerInvoker[invokerThreadCount];
  Arrays.setAll(invokers, t -> new CommandHandlerInvoker(cache, t));
  return invokers;
}

代码示例来源:origin: prestodb/presto

public Iterator<Page> getSortedPages()
  {
    return new AbstractIterator<Page>()
    {
      private int currentPosition;
      private final PageBuilder pageBuilder = new PageBuilder(types);
      private final int[] outputChannels = new int[types.size()];

      {
        Arrays.setAll(outputChannels, IntUnaryOperator.identity());
      }

      @Override
      public Page computeNext()
      {
        currentPosition = buildPage(currentPosition, outputChannels, pageBuilder);
        if (pageBuilder.isEmpty()) {
          return endOfData();
        }
        Page page = pageBuilder.build();
        pageBuilder.reset();
        return page;
      }
    };
  }
}

代码示例来源:origin: prestodb/presto

private static Page somePage(List<Type> types)
  {
    int[] initialValues = new int[types.size()];
    Arrays.setAll(initialValues, i -> 100 * i);
    return createSequencePage(types, 7, initialValues);
  }
}

代码示例来源:origin: prestodb/presto

private static DictionaryBlock createDictionaryBlockWithFailure(int dictionarySize, int blockSize)
{
  Block dictionary = createLongSequenceBlock(-10, dictionarySize - 10);
  int[] ids = new int[blockSize];
  Arrays.setAll(ids, index -> index % dictionarySize);
  return new DictionaryBlock(dictionary, ids);
}

代码示例来源:origin: prestodb/presto

private static DictionaryBlock createDictionaryBlockWithUnusedEntries(int dictionarySize, int blockSize)
{
  Block dictionary = createLongSequenceBlock(-10, dictionarySize);
  int[] ids = new int[blockSize];
  Arrays.setAll(ids, index -> (index % dictionarySize) + 10);
  return new DictionaryBlock(dictionary, ids);
}

代码示例来源:origin: prestodb/presto

private static DictionaryBlock createDictionaryBlock(int dictionarySize, int blockSize)
{
  Block dictionary = createLongSequenceBlock(0, dictionarySize);
  int[] ids = new int[blockSize];
  Arrays.setAll(ids, index -> index % dictionarySize);
  return new DictionaryBlock(dictionary, ids);
}

代码示例来源:origin: prestodb/presto

private static DictionaryBlock createDictionaryBlockWithFailure(int dictionarySize, int blockSize)
{
  Block dictionary = createLongSequenceBlock(-10, dictionarySize - 10);
  int[] ids = new int[blockSize];
  Arrays.setAll(ids, index -> index % dictionarySize);
  return new DictionaryBlock(dictionary, ids);
}

代码示例来源:origin: prestodb/presto

private static DictionaryBlock createDictionaryBlock(int dictionarySize, int blockSize)
{
  Block dictionary = createLongSequenceBlock(0, dictionarySize);
  int[] ids = new int[blockSize];
  Arrays.setAll(ids, index -> index % dictionarySize);
  return new DictionaryBlock(dictionary, ids);
}

代码示例来源:origin: prestodb/presto

private static DictionaryBlock createDictionaryBlockWithUnusedEntries(int dictionarySize, int blockSize)
{
  Block dictionary = createLongSequenceBlock(-10, dictionarySize);
  int[] ids = new int[blockSize];
  Arrays.setAll(ids, index -> (index % dictionarySize) + 10);
  return new DictionaryBlock(dictionary, ids);
}

代码示例来源:origin: ben-manes/caffeine

public MultiQueuePolicy(Config config) {
 MultiQueueSettings settings = new MultiQueueSettings(config);
 policyStats = new PolicyStats("linked.MultiQueue");
 threshold = new long[settings.numberOfQueues()];
 headQ = new Node[settings.numberOfQueues()];
 out = new Long2ObjectLinkedOpenHashMap<>();
 data = new Long2ObjectOpenHashMap<>();
 maximumSize = settings.maximumSize();
 lifetime = settings.lifetime();
 Arrays.setAll(headQ, Node::sentinel);
 Arrays.setAll(threshold, i -> 1L << i);
 maxOut = (int) (maximumSize * settings.percentOut());
}

代码示例来源:origin: ben-manes/caffeine

public S4WindowTinyLfuPolicy(double percentMain, S4WindowTinyLfuSettings settings) {
 String name = String.format("sketch.S4WindowTinyLfu (%.0f%%)", 100 * (1.0d - percentMain));
 this.policyStats = new PolicyStats(name);
 this.admittor = new TinyLfu(settings.config(), policyStats);
 this.maximumSize = settings.maximumSize();
 this.maxMain = (int) (maximumSize * percentMain);
 this.maxEden = maximumSize - maxMain;
 this.data = new Long2ObjectOpenHashMap<>();
 this.headEden = Node.sentinel(-1);
 this.levels = settings.levels();
 this.sizeMainQ = new int[levels];
 this.headMainQ = new Node[levels];
 Arrays.setAll(headMainQ, Node::sentinel);
}

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

@Override
public double[] compute(final Map<String, Object> combinedAggregators)
{
 final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators);
 final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()];
 Arrays.setAll(stats, i -> new SummaryStatistics());
 final ArrayOfDoublesSketchIterator it = sketch.iterator();
 while (it.next()) {
  final double[] values = it.getValues();
  for (int i = 0; i < values.length; i++) {
   stats[i].addValue(values[i]);
  }
 }
 final double[] means = new double[sketch.getNumValues()];
 Arrays.setAll(means, i -> stats[i].getMean());
 return means;
}

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

@Override
public double[] compute(final Map<String, Object> combinedAggregators)
{
 final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators);
 final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()];
 Arrays.setAll(stats, i -> new SummaryStatistics());
 final ArrayOfDoublesSketchIterator it = sketch.iterator();
 while (it.next()) {
  final double[] values = it.getValues();
  for (int i = 0; i < values.length; i++) {
   stats[i].addValue(values[i]);
  }
 }
 final double[] variances = new double[sketch.getNumValues()];
 Arrays.setAll(variances, i -> stats[i].getVariance());
 return variances;
}

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

private static SummaryStatistics[] getStats(final ArrayOfDoublesSketch sketch)
{
 final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()];
 Arrays.setAll(stats, i -> new SummaryStatistics());
 final ArrayOfDoublesSketchIterator it = sketch.iterator();
 while (it.next()) {
  final double[] values = it.getValues();
  for (int i = 0; i < values.length; i++) {
   stats[i].addValue(values[i]);
  }
 }
 return stats;
}

代码示例来源:origin: ben-manes/caffeine

public S4LruPolicy(Admission admission, Config config) {
 this.policyStats = new PolicyStats(admission.format("linked.S4Lru"));
 this.admittor = admission.from(config, policyStats);
 S4LruSettings settings = new S4LruSettings(config);
 this.data = new Long2ObjectOpenHashMap<>();
 this.maximumSize = settings.maximumSize();
 this.levels = settings.levels();
 this.headQ = new Node[levels];
 this.sizeQ = new int[levels];
 Arrays.setAll(headQ, Node::sentinel);
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public Vector map(IgniteDoubleFunction<Double> fun) {
  if (sto.isArrayBased()) {
    double[] data = sto.data();
    Arrays.setAll(data, (idx) -> fun.apply(data[idx]));
  }
  else {
    int len = size();
    for (int i = 0; i < len; i++)
      storageSet(i, fun.apply(storageGet(i)));
  }
  return this;
}

相关文章