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


Java IList.toArray方法代码示例

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


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

示例1: ilistCollect_whenSourceMap

import com.hazelcast.core.IList; //导入方法依赖的package包/类
@Test
public void ilistCollect_whenSourceMap() throws Exception {
    IStreamMap<String, Integer> map = getMap();
    fillMap(map);

    IList<Entry<String, Integer>> collected = map.stream().collect(toIList(randomString()));

    Entry<String, Integer>[] expecteds = map.entrySet().toArray(new Entry[0]);
    Entry<String, Integer>[] actuals = collected.toArray(new Entry[0]);

    Comparator<Entry<String, Integer>> entryComparator = Comparator.comparing(Entry::getKey);
    Arrays.sort(expecteds, entryComparator);
    Arrays.sort(actuals, entryComparator);

    assertArrayEquals(expecteds, actuals);
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:17,代码来源:JetCollectorTest.java

示例2: ilistCollect_whenSourceCache

import com.hazelcast.core.IList; //导入方法依赖的package包/类
@Test
public void ilistCollect_whenSourceCache() throws Exception {
    IStreamCache<String, Integer> cache = getCache();
    fillCache(cache);

    IList<Entry<String, Integer>> collected = cache.stream().collect(toIList(randomString()));

    Cache.Entry<String, Integer>[] expecteds = new Cache.Entry[cache.size()];
    int count = 0;
    for (Cache.Entry<String, Integer> entry : cache) {
        expecteds[count++] = entry;
    }
    Map.Entry<String, Integer>[] actuals = collected.toArray(new Map.Entry[0]);

    Arrays.sort(expecteds, Comparator.comparing(Cache.Entry::getKey));
    Arrays.sort(actuals, Comparator.comparing(Map.Entry::getKey));

    assertEquals(expecteds.length, actuals.length);
    for (int i = 0; i < expecteds.length; i++) {
        assertEquals(expecteds[i].getKey(), actuals[i].getKey());
        assertEquals(expecteds[i].getValue(), actuals[i].getValue());
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:24,代码来源:JetCollectorTest.java

示例3: toArray

import com.hazelcast.core.IList; //导入方法依赖的package包/类
@Override
public Object[] toArray() {
    IList<E_OUT> list = collect(toIList(uniqueListName()));
    Object[] array = list.toArray();
    list.destroy();
    return array;
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:8,代码来源:AbstractPipe.java

示例4: assertList

import com.hazelcast.core.IList; //导入方法依赖的package包/类
private void assertList(IList<Integer> list) {
    assertEquals(COUNT, list.size());

    Integer[] result = list.toArray(new Integer[COUNT]);
    Arrays.sort(result);
    for (int i = 0; i < COUNT; i++) {
        int val = result[i];
        assertEquals(i * i, val);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:11,代码来源:MapTest.java

示例5: mapToObj

import com.hazelcast.core.IList; //导入方法依赖的package包/类
@Test
public void mapToObj() {
    IList<Double> list = stream.mapToObj(m -> (Double) m).collect(DistributedCollectors.toIList(randomString()));

    Object[] array = list.toArray();
    Arrays.sort(array);
    assertEquals(COUNT, array.length);

    for (int i = 0; i < array.length; i++) {
        assertEquals((double) i, (Double) array[i], 0D);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:13,代码来源:DoubleStreamTest.java

示例6: mapToObj

import com.hazelcast.core.IList; //导入方法依赖的package包/类
@Test
public void mapToObj() {
    IList<Long> list = stream.mapToObj(m -> (Long) m).collect(DistributedCollectors.toIList(randomString()));

    Object[] array = list.toArray();
    Arrays.sort(array);
    assertEquals(COUNT, array.length);

    for (int i = 0; i < array.length; i++) {
        assertEquals((long) i, array[i]);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:13,代码来源:LongStreamTest.java

示例7: assertList

import com.hazelcast.core.IList; //导入方法依赖的package包/类
private void assertList(IList<Integer> list, boolean square) {
    assertEquals(COUNT, list.size());
    Integer[] result = list.toArray(new Integer[COUNT]);
    Arrays.sort(result);
    for (int i = 0; i < COUNT; i++) {
        int val = result[i];
        assertEquals(i * (square ? i : 1), val);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:10,代码来源:MultipleTransformsTest.java

示例8: mapToObj

import com.hazelcast.core.IList; //导入方法依赖的package包/类
@Test
public void mapToObj() {
    IList<Integer> list = stream.mapToObj(m -> m).collect(DistributedCollectors.toIList(randomString()));

    Object[] array = list.toArray();
    Arrays.sort(array);
    assertEquals(COUNT, array.length);

    for (int i = 0; i < array.length; i++) {
        assertEquals(i, array[i]);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:13,代码来源:IntStreamTest.java

示例9: assertNotSorted

import com.hazelcast.core.IList; //导入方法依赖的package包/类
private void assertNotSorted(IList<Integer> list) {
    assertEquals(COUNT, list.size());
    Integer[] result = list.toArray(new Integer[COUNT]);

    assertNotSorted(result);

    Arrays.sort(result);
    for (int i = 0; i < COUNT; i++) {
        assertEquals(i, (int) result[i]);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:12,代码来源:UnorderedTest.java

示例10: sortedList

import com.hazelcast.core.IList; //导入方法依赖的package包/类
static <T> List<T> sortedList(IList<T> list) {
    @SuppressWarnings("unchecked") T[] array = (T[]) new Object[list.size()];
    list.toArray(array);
    Arrays.sort(array);
    return Arrays.asList(array);
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:7,代码来源:AbstractStreamTest.java


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