Example usage for com.google.common.collect Maps asMap

List of usage examples for com.google.common.collect Maps asMap

Introduction

In this page you can find the example usage for com.google.common.collect Maps asMap.

Prototype

@GwtIncompatible("NavigableMap")
public static <K, V> NavigableMap<K, V> asMap(NavigableSet<K> set, Function<? super K, V> function) 

Source Link

Document

Returns a view of the navigable set as a map, mapping keys from the set according to the specified function.

Usage

From source file:com.stackframe.sarariman.telephony.twilio.IncomingTwilioSMSHandler.java

private static Map<String, String> flatten(Map<String, String[]> m) {
    return Maps.asMap(m.keySet(), (k) -> m.get(k)[0]);
}

From source file:de.tuberlin.uebb.jdae.llmsl.BlockConstant.java

public final static Map<GlobalVariable, BlockVariable> globalCtxt(Set<GlobalVariable> vars) {
    return Maps.asMap(vars, GLOB_CONSTANT);
}

From source file:ec.nbdemetra.ui.awt.InputMaps.java

@Nonnull
public static Map<KeyStroke, Object> asMap(@Nonnull InputMap inputMap, boolean includeParentKeys) {
    return Maps.asMap(asKeySet(inputMap, includeParentKeys), asKeyToValueFunction(inputMap));
}

From source file:ec.nbdemetra.ui.awt.ActionMaps.java

@Nonnull
public static Map<Object, Action> asMap(@Nonnull ActionMap actionMap, boolean includeParentKeys) {
    return Maps.asMap(asKeySet(actionMap, includeParentKeys), asKeyToValueFunction(actionMap));
}

From source file:com.stackframe.sarariman.vacation.VacationsImpl.java

public Map<? extends Number, VacationEntry> getMap() {
    Function<Number, VacationEntry> f = new Function<Number, VacationEntry>() {
        public VacationEntry apply(Number n) {
            return get(n.intValue());
        }/*from  ww  w.  ja  va  2  s.c  o  m*/

    };
    return Maps.asMap(Numbers.positiveIntegers, f);

}

From source file:com.stackframe.sarariman.invoices.InvoicesImpl.java

public Map<? extends Number, Invoice> getMap() {
    System.err.println("in invoicesImpl::getMap");
    Function<Number, Invoice> f = new Function<Number, Invoice>() {
        public Invoice apply(Number n) {
            System.err.println("in invoicesImpl::getMap::apply n=" + n);
            return get(n.intValue());
        }/*from   w  ww. ja  va 2 s.  c  o m*/

    };
    return Maps.asMap(Numbers.positiveIntegers, f);
}

From source file:com.stackframe.sarariman.timesheets.TimesheetsImpl.java

public Map<Employee, Map<Week, Timesheet>> getMap() {
    return Maps.asMap(sarariman.getDirectory().getEmployees(), new Function<Employee, Map<Week, Timesheet>>() {
        public Map<Week, Timesheet> apply(final Employee e) {
            return e.getTimesheets();
        }//from   ww  w.j a  va  2  s.co m

    });
}

From source file:edu.uci.ics.jung.algorithms.scoring.DegreeScorer.java

public Map<N, Integer> nodeScores() {
    return Maps.asMap(graph.nodes(), node -> graph.degree(node));
}

From source file:edu.uci.ics.jung.layout.model.LayoutModel.java

/** @return a mapping of Nodes to Point locations */
default Map<N, Point> getLocations() {
    return Collections.unmodifiableMap(Maps.asMap(getGraph().nodes(), this::apply));
}

From source file:com.stackframe.sarariman.tasks.TasksImpl.java

public Map<? extends Number, Task> getMap() {
    Function<Number, Task> f = new Function<Number, Task>() {
        public Task apply(Number f) {
            return get(f.intValue());
        }//from w  w w .  j ava  2  s .c om

    };
    return Maps.asMap(Numbers.positiveIntegers, f);
}