當前位置: 首頁>>代碼示例>>Java>>正文


Java Arrays.setAll方法代碼示例

本文整理匯總了Java中java.util.Arrays.setAll方法的典型用法代碼示例。如果您正苦於以下問題:Java Arrays.setAll方法的具體用法?Java Arrays.setAll怎麽用?Java Arrays.setAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Arrays的用法示例。


在下文中一共展示了Arrays.setAll方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: map

import java.util.Arrays; //導入方法依賴的package包/類
/** {@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;
}
 
開發者ID:Luodian,項目名稱:Higher-Cloud-Computing-Project,代碼行數:17,代碼來源:AbstractVector.java

示例2: RealTimeTradeProducer

import java.util.Arrays; //導入方法依賴的package包/類
private RealTimeTradeProducer(int index, String broker, String topic, int tradesPerSecond, int keysFrom, int keysTo) throws IOException,
        URISyntaxException {
    if (tradesPerSecond <= 0) {
        throw new RuntimeException("tradesPerSecond=" + tradesPerSecond);
    }
    this.index = index;
    this.topic = topic;
    this.tradesPerSecond = tradesPerSecond;
    tickers = new String[keysTo - keysFrom];
    Arrays.setAll(tickers, i -> "T-" + Integer.toString(i + keysFrom));
    Properties props = new Properties();
    props.setProperty("bootstrap.servers", broker);
    props.setProperty("key.serializer", LongSerializer.class.getName());
    props.setProperty("value.serializer", TradeSerializer.class.getName());
    this.producer = new KafkaProducer<>(props);
}
 
開發者ID:hazelcast,項目名稱:big-data-benchmark,代碼行數:17,代碼來源:RealTimeTradeProducer.java

示例3: parse

import java.util.Arrays; //導入方法依賴的package包/類
/**
 * Parses a GFA file to a {@link Graph}.
 *
 * @param gfaFile         an instance of {@link GfaFile}
 * @param progressUpdater a {@link ProgressUpdater} to notify interested parties on progress updates
 * @return a {@link Graph}
 * @throws GfaParseException if the given {@link String} is not GFA-compliant
 */
@EnsuresNonNull("nodeArrays")
public Graph parse(final GfaFile gfaFile, final ProgressUpdater progressUpdater) throws GfaParseException {
    try {
        LOGGER.info("Start allocating nodes");
        final BufferedReader nodeAllocationReader = gfaFile.readFile();
        allocateNodes(nodeAllocationReader, progressUpdater);
        LOGGER.info("Finished allocating nodes");

        nodeArrays = new int[nodeIds.size()][];
        Arrays.setAll(nodeArrays, i -> Graph.createEmptyNodeArray());

        genomeMapping = new HashMap<>();

        LOGGER.info("Start parsing lines");
        parseLines(gfaFile.getInputStream(), progressUpdater);
        LOGGER.info("Finished parsing lines");
    } catch (final IOException e) {
        throw new GfaParseException("An error while reading the GFA file.", e);
    }

    final Graph graph = new Graph(nodeArrays, gfaFile);
    gfaFile.setGenomeMapping(genomeMapping);

    addEdgesToSentinelNodes(graph);

    return graph;
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:36,代碼來源:GfaParser.java

示例4: run2

import java.util.Arrays; //導入方法依賴的package包/類
@Test
public void run2() {
    int[] arr=new int[10000000];
    Random r=new Random();
    /**串行給數組中每一個元素都附上一個隨機值*/
    Arrays.setAll(arr, (i)->r.nextInt());

    /**並行給數組中每一個元素都附上一個隨機值*/
    Arrays. parallelSetAll (arr, (i)->r.nextInt());
}
 
開發者ID:zhangboqing,項目名稱:multithread,代碼行數:11,代碼來源:Parallel_Sort.java

示例5: testSetAllString

import java.util.Arrays; //導入方法依賴的package包/類
@Test(dataProvider = "string")
public void testSetAllString(String name, int size, IntFunction<String> generator, String[] expected) {
    String[] result = new String[size];
    Arrays.setAll(result, generator);
    assertEquals(result, expected, "setAll(String[], IntFunction<String>) case " + name + " failed.");

    // ensure fresh array
    result = new String[size];
    Arrays.parallelSetAll(result, generator);
    assertEquals(result, expected, "parallelSetAll(String[], IntFunction<String>) case " + name + " failed.");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:12,代碼來源:SetAllTest.java

示例6: testSetAllInt

import java.util.Arrays; //導入方法依賴的package包/類
@Test(dataProvider = "int")
public void testSetAllInt(String name, int size, IntUnaryOperator generator, int[] expected) {
    int[] result = new int[size];
    Arrays.setAll(result, generator);
    assertEquals(result, expected, "setAll(int[], IntUnaryOperator) case " + name + " failed.");

    // ensure fresh array
    result = new int[size];
    Arrays.parallelSetAll(result, generator);
    assertEquals(result, expected, "parallelSetAll(int[], IntUnaryOperator) case " + name + " failed.");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:12,代碼來源:SetAllTest.java

示例7: testSetAllLong

import java.util.Arrays; //導入方法依賴的package包/類
@Test(dataProvider = "long")
public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) {
    long[] result = new long[size];
    Arrays.setAll(result, generator);
    assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed.");

    // ensure fresh array
    result = new long[size];
    Arrays.parallelSetAll(result, generator);
    assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed.");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:12,代碼來源:SetAllTest.java

示例8: testSetAllDouble

import java.util.Arrays; //導入方法依賴的package包/類
@Test(dataProvider = "double")
public void testSetAllDouble(String name, int size, IntToDoubleFunction generator, double[] expected) {
    double[] result = new double[size];
    Arrays.setAll(result, generator);
    assertDoubleArrayEquals(result, expected, 0.05, "setAll(double[], IntToDoubleFunction) case " + name + " failed.");

    // ensure fresh array
    result = new double[size];
    Arrays.parallelSetAll(result, generator);
    assertDoubleArrayEquals(result, expected, 0.05, "setAll(double[], IntToDoubleFunction) case " + name + " failed.");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:12,代碼來源:SetAllTest.java

示例9: protoNum

import java.util.Arrays; //導入方法依賴的package包/類
private static NumberProto.Number protoNum(int i) {
    Integer[] ints = new Integer[32 * 1024];
    Arrays.setAll(ints, operand -> i);

    return NumberProto.Number.newBuilder().addAllNumber(Arrays.asList(ints)).build();
}
 
開發者ID:salesforce,項目名稱:reactive-grpc,代碼行數:7,代碼來源:BackpressureIntegrationTest.java

示例10: getFixedColumnTypes

import java.util.Arrays; //導入方法依賴的package包/類
private List<String> getFixedColumnTypes(final RelationalInput input) {
  final String[] types = new String[input.numberOfColumns()];
  Arrays.setAll(types, index -> STRING_COLUMN_TYE);
  return asList(types);
}
 
開發者ID:HPI-Information-Systems,項目名稱:AdvancedDataProfilingSeminar,代碼行數:6,代碼來源:TableInfoFactory.java

示例11: setCallData

import java.util.Arrays; //導入方法依賴的package包/類
public EVMEnvironmentBuilder setCallData(byte[] callData) {
    Byte[] bytes = new Byte[callData.length];
    Arrays.setAll(bytes, n -> callData[n]);
    this.callData = Arrays.asList(bytes);
    return this;
}
 
開發者ID:fergarrui,項目名稱:ethereum-bytecode-analyzer,代碼行數:7,代碼來源:EVMEnvironment.java

示例12: widen

import java.util.Arrays; //導入方法依賴的package包/類
private static MethodHandle widen(MethodHandle mh, MethodType type) {
  MethodHandle[] filters = new MethodHandle[type.parameterCount()];
  Arrays.setAll(filters, i -> widener(type.parameterType(i)));
  return filterArguments(mh, 0, filters).asType(type);
}
 
開發者ID:forax,項目名稱:mjolnir,代碼行數:6,代碼來源:TupleHandle.java


注:本文中的java.util.Arrays.setAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。