List of usage examples for com.google.common.collect Multiset retainAll
@Override
boolean retainAll(Collection<?> c);
Note: This method ignores how often any element might appear in c , and only cares whether or not an element appears at all.
From source file:org.summer.dsl.model.types.util.TypeConformanceComputer.java
/** * Keeps the cumulated distance for all the common raw super types of the given references. * Interfaces that are more directly implemented will get a lower total count than more general * interfaces.//from www. ja v a 2 s.c o m */ protected void cumulateDistance(final List<JvmTypeReference> references, Multimap<JvmType, JvmTypeReference> all, Multiset<JvmType> cumulatedDistance) { for (JvmTypeReference other : references) { Multiset<JvmType> otherDistance = LinkedHashMultiset.create(); initializeDistance(other, all, otherDistance); cumulatedDistance.retainAll(otherDistance); for (Multiset.Entry<JvmType> typeToDistance : otherDistance.entrySet()) { if (cumulatedDistance.contains(typeToDistance.getElement())) cumulatedDistance.add(typeToDistance.getElement(), typeToDistance.getCount()); } } }
From source file:org.summer.dsl.xbase.typesystem.conformance.TypeConformanceComputer.java
/** * Keeps the cumulated distance for all the common raw super types of the given references. * Interfaces that are more directly implemented will get a lower total count than more general * interfaces./*from w ww.j av a 2 s . co m*/ */ protected void cumulateDistance(final List<LightweightTypeReference> references, Multimap<JvmType, LightweightTypeReference> all, Multiset<JvmType> cumulatedDistance) { for (LightweightTypeReference other : references) { Multiset<JvmType> otherDistance = LinkedHashMultiset.create(); initializeDistance(other, all, otherDistance); cumulatedDistance.retainAll(otherDistance); for (Multiset.Entry<JvmType> typeToDistance : otherDistance.entrySet()) { if (cumulatedDistance.contains(typeToDistance.getElement())) cumulatedDistance.add(typeToDistance.getElement(), typeToDistance.getCount()); } } }