org.tensorics.core.util.MoreMultisets Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tensorics-core Show documentation
Show all versions of tensorics-core Show documentation
Tensorics is a java framework which uses a tensor as a central object. A tensor represents a set of values placed in an N-dimensional space. Wherever you are tempted to use maps of maps, a tensor might be a good choice ;-) Tensorics provides methods to create, transform and performing calculations with those tensors.
package org.tensorics.core.util;
import static com.google.common.collect.Multisets.difference;
import com.google.common.collect.ImmutableMultiset;
import com.google.common.collect.Multiset;
public class MoreMultisets {
private MoreMultisets() {
/* only static methods */
}
public static boolean containsNonUniqueElements(Multiset dimensions) {
return dimensions.size() > dimensions.elementSet().size();
}
public static Multiset nonUniqueElementsOf(Multiset dimensions) {
return difference(dimensions, ImmutableMultiset.copyOf(dimensions.elementSet()));
}
}