Example usage for com.google.common.collect HashMultimap create

List of usage examples for com.google.common.collect HashMultimap create

Introduction

In this page you can find the example usage for com.google.common.collect HashMultimap create.

Prototype

public static <K, V> HashMultimap<K, V> create() 

Source Link

Document

Creates a new, empty HashMultimap with the default initial capacities.

Usage

From source file:com.datastax.driver.core.DirectedGraph.java

DirectedGraph(List<V> vertices) {
    this.vertices = Maps.newHashMapWithExpectedSize(vertices.size());
    this.adjacencyList = HashMultimap.create();

    for (V vertex : vertices) {
        this.vertices.put(vertex, 0);
    }/*ww  w  .  j  ava2s .  c o m*/
}

From source file:org.locationtech.geogig.osm.internal.FeatureMapFlusher.java

public FeatureMapFlusher(WorkingTree workTree) {
    this.workTree = workTree;
    map = HashMultimap.create();
    count = 0;
}

From source file:cuchaz.enigma.convert.FieldMatches.java

public FieldMatches() {
    m_matches = HashBiMap.create();/*from   w  ww.  jav  a  2  s  . c o m*/
    m_matchedSourceFields = HashMultimap.create();
    m_unmatchedSourceFields = HashMultimap.create();
    m_unmatchedDestFields = HashMultimap.create();
    m_unmatchableSourceFields = HashMultimap.create();
}

From source file:blow.eventbus.AnnotatedHandlerFinder.java

/**
 * {@inheritDoc}//  w w  w  . j  a  v a  2  s.  c  om
 *
 * This implementation finds all methods marked with a {@link Subscribe}
 * annotation.
 */
@Override
public Multimap<Class<?>, EventHandler> findAllHandlers(Object listener) {
    Multimap<Class<?>, EventHandler> methodsInListener = HashMultimap.create();
    Class<?> clazz = listener.getClass();
    while (clazz != null) {
        for (Method method : clazz.getMethods()) {
            Subscribe annotation = method.getAnnotation(Subscribe.class);

            if (annotation != null) {
                Class<?>[] parameterTypes = method.getParameterTypes();
                if (parameterTypes.length != 1) {
                    throw new IllegalArgumentException("Method " + method
                            + " has @Subscribe annotation, but requires " + parameterTypes.length
                            + " arguments.  Event handler methods " + "must require a single argument.");
                }
                Class<?> eventType = parameterTypes[0];
                EventHandler handler = makeHandler(listener, method);

                methodsInListener.put(eventType, handler);
            }
        }
        clazz = clazz.getSuperclass();
    }
    return methodsInListener;
}

From source file:org.n52.oxf.request.MultimapRequestParameters.java

protected MultimapRequestParameters() {
    parameters = HashMultimap.create();
}

From source file:org.apache.rya.accumulo.query.RangeBindingSetEntries.java

public RangeBindingSetEntries() {
    ranges = HashMultimap.create();
}

From source file:org.vclipse.configscan.views.ErrorBasedContentProvider.java

public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    if (viewer instanceof JobAwareTreeViewer) {
        testCase2TreePath = HashMultimap.create();
        input = (ConfigScanViewInput) newInput;
    }//from  w w  w .java2 s  .  c om
}

From source file:org.sosy_lab.cpachecker.util.predicates.z3.matching.SmtAstMatchResultImpl.java

public SmtAstMatchResultImpl() {
    this.argumentPatternMatches = HashMultimap.create();
    this.variableBindings = HashMultimap.create();
}

From source file:com.ironiacorp.network.tool.nf.ArpDatabase.java

public Multimap<InetAddress, MacAddress> findBogusIP() {
    Multimap<InetAddress, MacAddress> result = HashMultimap.create();
    Iterator<InetAddress> i = ypIM.keySet().iterator();
    while (i.hasNext()) {
        InetAddress ip = i.next();
        Collection<MacAddress> macs = ypIM.get(ip);
        if (macs.size() > 1) {
            Iterator<MacAddress> j = macs.iterator();
            while (j.hasNext()) {
                MacAddress mac = j.next();
                result.put(ip, mac);//from   w  ww.j a va  2s.  com
            }
        }
    }

    return result;
}

From source file:weld.guiceconfig.internal.CdiBindingOracle.java

public static CdiBindingOracle process(List<Element> elementList) {

    final HashMultimap<Class, Class<? extends Annotation>> annotations = HashMultimap.create();
    final HashMap<Class, Class<? extends Annotation>> scopes = Maps.newHashMap();
    final HashSet<InterceptorBinding> interceptors = Sets.newHashSet();

    for (Element element : elementList) {
        element.acceptVisitor(new ElementVisitor<Void>() {

            @Override/*from w  ww . jav  a2  s.c o  m*/
            public <T> Void visit(Binding<T> binding) {
                Key<T> key = binding.getKey();
                Key targetKey = binding.acceptTargetVisitor(targetExtractor);
                Class<? extends Annotation> scope = binding.acceptScopingVisitor(scopeExtractor);
                processBinding(key, targetKey, scope, annotations, scopes);
                return null;
            }

            @Override
            public Void visit(InterceptorBinding interceptorBinding) {
                interceptors.add(interceptorBinding);
                return null;
            }

            @Override
            public Void visit(ScopeBinding scopeBinding) {
                log.warn("bindScope(...); not supported.");
                return null;
            }

            @Override
            public Void visit(TypeConverterBinding typeConverterBinding) {
                log.warn("convertToTypes(...); not supported.");
                return null;
            }

            @Override
            public Void visit(InjectionRequest injectionRequest) {
                log.warn("requestInjection(...); not supported.");
                return null;
            }

            @Override
            public Void visit(StaticInjectionRequest staticInjectionRequest) {
                log.warn("requestStaticInjection(...); not supported.");
                return null;
            }

            @Override
            public <T> Void visit(ProviderLookup<T> tProviderLookup) {
                log.warn("getProvider(...); not supported.");
                return null;
            }

            @Override
            public <T> Void visit(MembersInjectorLookup<T> tMembersInjectorLookup) {
                log.warn("getMembersInjector(...); not supported.");
                return null;
            }

            @Override
            public Void visit(Message message) {
                log.warn("addError(...); not supported.");
                return null;
            }

            @Override
            public Void visit(PrivateElements privateElements) {
                log.warn("expose(...); not supported.");
                return null;
            }

            @Override
            public Void visit(TypeListenerBinding typeListenerBinding) {
                log.warn("bindListener(...); not supported.");
                return null;
            }
        });

    }

    return new CdiBindingOracle(ImmutableMultimap.copyOf(annotations), ImmutableMap.copyOf(scopes),
            ImmutableList.copyOf(interceptors));
}