本文整理汇总了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);
}
示例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());
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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]);
}
}
示例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);
}
}
示例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]);
}
}
示例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]);
}
}
示例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);
}