本文整理汇总了Java中com.gs.collections.api.RichIterable类的典型用法代码示例。如果您正苦于以下问题:Java RichIterable类的具体用法?Java RichIterable怎么用?Java RichIterable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RichIterable类属于com.gs.collections.api包,在下文中一共展示了RichIterable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detectNotFullTopLevelObjects
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
private List<String> detectNotFullTopLevelObjects(final Map<String, MithraObjectConfigurationType> allDefinedClasses, CacheLoaderType cacheLoaderType)
{
final List<String> notFullClassNames = FastList.newList();
MutableListMultimap<String,TopLevelLoaderType> classesByName = ListAdapter.adapt(cacheLoaderType.getTopLevelLoaders()).groupBy(new Function<TopLevelLoaderType, String>()
{
@Override
public String valueOf(final TopLevelLoaderType topLevelLoaderType)
{
MithraObjectConfigurationType objectConfigurationType = allDefinedClasses.get(topLevelLoaderType.getClassToLoad());
if (objectConfigurationType == null || !objectConfigurationType.getCacheType().isFull())
{
notFullClassNames.add(topLevelLoaderType.getClassToLoad());
}
return topLevelLoaderType.getClassToLoad() + topLevelLoaderType.getSourceAttributes() + topLevelLoaderType.getFactoryClass();
}
});
RichIterable<RichIterable<TopLevelLoaderType>> listOfDupes = classesByName.multiValuesView().select(Predicates.attributeGreaterThan(Functions.getSizeOf(), 1));
this.assertEmpty("Found duplicates in TopLevel Loader:" + this.printListOfTopLevelLoaderType(listOfDupes), listOfDupes.toList());
return notFullClassNames;
}
示例2: detectNotFullDependentObjects
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
private List<String> detectNotFullDependentObjects(final Map<String, MithraObjectConfigurationType> allDefinedClasses, CacheLoaderType cacheLoaderType)
{
final List<String> notFullClassNames = FastList.newList();
MutableListMultimap<String,DependentLoaderType> classesByName = ListAdapter.adapt(cacheLoaderType.getDependentLoaders()).groupBy(new Function<DependentLoaderType, String>()
{
@Override
public String valueOf(final DependentLoaderType dependentLoaderType)
{
final String className = dependentLoaderType.getRelationship().substring(0, dependentLoaderType.getRelationship().lastIndexOf("."));
MithraObjectConfigurationType objectConfigurationType = allDefinedClasses.get(className);
if (objectConfigurationType == null || !objectConfigurationType.getCacheType().isFull())
{
notFullClassNames.add(dependentLoaderType.getRelationship());
}
return dependentLoaderType.getRelationship() + dependentLoaderType.getHelperFactoryClass();
}
});
RichIterable<RichIterable<DependentLoaderType>> listOfDupes = classesByName.multiValuesView().select(Predicates.attributeGreaterThan(Functions.getSizeOf(), 1));
this.assertEmpty("Found duplicates in Dependent Relationship:" + this.printListOfDependentLoaderType(listOfDupes), listOfDupes.toList());
return notFullClassNames;
}
示例3: applyKeyDeltas
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
public static <K> void applyKeyDeltas(final RichIterable<KeyDelta<K>> deltas, final MutableSet<K> entries) {
deltas.forEach(new Procedure<KeyDelta<K>>() {
@Override
public void value(final KeyDelta<K> delta) {
final K key = delta.getKey();
switch (delta.getDeltaType()) {
case ADD:
case UPDATE:
if (!entries.contains(key)) {
entries.add(key);
}
break;
case DELETE:
if (entries.contains(key)) {
entries.remove(key);
}
break;
}
}
});
}
示例4: printListOfDependentLoaderType
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
private String printListOfDependentLoaderType(RichIterable<RichIterable<DependentLoaderType>> items)
{
final StringBuilder builder = new StringBuilder("[[");
for (int i =0; i < items.toList().size(); i++)
{
RichIterable listOfBreaks = items.toList().get(i);
DependentLoaderType dependentLoaderType = (DependentLoaderType)listOfBreaks.getFirst();
builder.append(dependentLoaderType.getRelationship() + "/" + dependentLoaderType.getHelperFactoryClass() + ",");
}
builder.append("]]");
return builder.toString();
}
示例5: printListOfTopLevelLoaderType
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
private String printListOfTopLevelLoaderType(RichIterable<RichIterable<TopLevelLoaderType>> items)
{
final StringBuilder builder = new StringBuilder("[[");
for (int i =0; i < items.toList().size(); i++)
{
RichIterable listOfBreaks = items.toList().get(i);
TopLevelLoaderType topLevelLoaderType = (TopLevelLoaderType)listOfBreaks.getFirst();
builder.append(topLevelLoaderType.getClassToLoad() + "/" + topLevelLoaderType.getSourceAttributes() + "/" + topLevelLoaderType.getFactoryClass() + ",");
}
builder.append("]]");
return builder.toString();
}
示例6: applyKeyModelPairDeltas
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
public static <K, K2, D extends ModelDelta<K2, B, DB>, DB extends ModelDeltaBuilder<K2, D>, B extends ModelBuilder<K2, ?, D>> void applyKeyModelPairDeltas(
final RichIterable<KeyModelDeltaPairDelta<K, K2, D, DB>> deltas, final MutableMap<K, B> builders) {
deltas.forEach(new Procedure<KeyModelDeltaPairDelta<K, K2, D, DB>>() {
@Override
public void value(final KeyModelDeltaPairDelta<K, K2, D, DB> delta) {
B builder = builders.get(delta.getKey());
switch (delta.getDeltaType()) {
case ADD:
case UPDATE:
if (builder == null || !builder.getKey().equals(delta.getValue().getKey())) {
builder = delta.getValue().toBuilder();
builders.put(delta.getKey(), builder);
}
else {
builder.applyDelta(delta.getValue());
}
break;
case DELETE:
if (builder != null) {
builders.removeKey(delta.getKey());
}
break;
}
}
});
}
示例7: buildKeyDelta
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
public static <K> ImmutableList<KeyDelta<K>> buildKeyDelta(final RichIterable<? extends KeyDelta.Builder<K>> builders) {
return builders.collect(new Function<KeyDelta.Builder<K>, KeyDelta<K>>() {
@Override
public KeyDelta<K> valueOf(final KeyDelta.Builder<K> builder) {
return builder.buildDelta();
}
}).select(Predicates.notNull()).toList().toImmutable();
}
示例8: buildKeyValuePairDelta
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
public static <K, V> ImmutableList<KeyValuePairDelta<K, V>> buildKeyValuePairDelta(RichIterable<KeyValuePairDelta.Builder<K, V>> builders) {
return builders.collect(new Function<KeyValuePairDelta.Builder<K, V>, KeyValuePairDelta<K, V>>() {
@Override
public KeyValuePairDelta<K, V> valueOf(final KeyValuePairDelta.Builder<K, V> builder) {
return builder.buildDelta();
}
}).select(Predicates.notNull()).toList().toImmutable();
}
示例9: buildKeyModelDeltaPairDelta
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
public static <K, K2, D extends ModelDelta<K2, B, DB>, B extends ModelBuilder<K2, ?, D>, DB extends ModelDeltaBuilder<K2, D>> ImmutableList<KeyModelDeltaPairDelta<K, K2, D, DB>> buildKeyModelDeltaPairDelta(
final RichIterable<KeyModelDeltaPairDelta.Builder<K, K2, D, DB>> builders) {
return builders.collect(new Function<KeyModelDeltaPairDelta.Builder<K, K2, D, DB>, KeyModelDeltaPairDelta<K, K2, D, DB>>() {
@Override
public KeyModelDeltaPairDelta<K, K2, D, DB> valueOf(final KeyModelDeltaPairDelta.Builder<K, K2, D, DB> builder) {
return builder.buildDelta();
}
}).select(Predicates.notNull()).toList().toImmutable();
}
示例10: gsCombinations
import com.gs.collections.api.RichIterable; //导入依赖的package包/类
public RichIterable<CoBuy> gsCombinations(RichIterable<Purchases.Purchase> purchases) {
return purchases.flatCollect(x -> purchases.select(y -> x != y)
.collect(y -> new CoBuy(x.getProductId(), y.getProductId())));
}