Example usage for java.util Map get

List of usage examples for java.util Map get

Introduction

In this page you can find the example usage for java.util Map get.

Prototype

V get(Object key);

Source Link

Document

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Usage

From source file:Main.java

/**
 * Returns a cached thread-local {@link CharsetEncoder} for the specified
 * <tt>charset</tt>.//from   ww  w .  jav a  2 s  . c  om
 */
public static CharsetEncoder getEncoder(Charset charset) {
    if (charset == null) {
        throw new NullPointerException("charset");
    }

    Map<Charset, CharsetEncoder> map = encoders.get();
    CharsetEncoder e = map.get(charset);
    if (e != null) {
        e.reset();
        e.onMalformedInput(CodingErrorAction.REPLACE);
        e.onUnmappableCharacter(CodingErrorAction.REPLACE);
        return e;
    }

    e = charset.newEncoder();
    e.onMalformedInput(CodingErrorAction.REPLACE);
    e.onUnmappableCharacter(CodingErrorAction.REPLACE);
    map.put(charset, e);
    return e;
}

From source file:Main.java

/**
 * Returns a cached thread-local {@link CharsetDecoder} for the specified
 * <tt>charset</tt>./*www.  ja  va 2  s  .c o m*/
 */
public static CharsetDecoder getDecoder(Charset charset) {
    if (charset == null) {
        throw new NullPointerException("charset");
    }

    Map<Charset, CharsetDecoder> map = decoders.get();
    CharsetDecoder d = map.get(charset);
    if (d != null) {
        d.reset();
        d.onMalformedInput(CodingErrorAction.REPLACE);
        d.onUnmappableCharacter(CodingErrorAction.REPLACE);
        return d;
    }

    d = charset.newDecoder();
    d.onMalformedInput(CodingErrorAction.REPLACE);
    d.onUnmappableCharacter(CodingErrorAction.REPLACE);
    map.put(charset, d);
    return d;
}

From source file:Main.java

public static Object get(String key) {

    Map<String, Object> map = wfThreadLocal.get();
    if (map == null) {
        return null;
    }//w  w w  .  ja  v a2 s. co m

    return map.get(key);
}

From source file:Main.java

public static String getMapValue(Map<String, Object> map, String key) {
    String value = "";
    if (map != null) {
        if (map.containsKey(key) && map.get(key) != null) {
            value = (String) map.get(key);
        }//from ww w .  j  av  a2  s.c o  m
    }
    return value;
}

From source file:com.nabla.wapp.server.xml.Importer.java

@SuppressWarnings("unchecked")
public static <T> T getContext(final Map session) {
    return (T) session.get(ImportVisitorStrategy.KEY_CTX);
}

From source file:Main.java

public static boolean checkRepeatOrNot(Map<String, Object> map, Set[] sets, String[] fields) {
    for (int i = 0; i < fields.length; i++) {
        if (!sets[i].add(map.get(fields[i]))) {
            return true;
        }//from  w  w  w.  ja  v a 2 s .com
    }
    return false;
}

From source file:com.adeptj.runtime.core.Launcher.java

private static void launchBrowser(Map<String, String> commands) {
    if (Boolean.parseBoolean(commands.get(Constants.ARG_OPEN_CONSOLE))) {
        try {/*w w  w. j  a  va  2  s  .  c  om*/
            Environment.launchBrowser(new URL(String.format(Constants.OSGI_CONSOLE_URL,
                    Configs.of().undertow().getConfig(Constants.KEY_HTTP).getInt(Constants.KEY_PORT))));
        } catch (IOException ex) {
            // Just log it, its okay if browser is not launched.
            LoggerFactory.getLogger(Launcher.class).error("Exception while launching browser!!", ex);
        }
    }
}

From source file:io.gromit.uaparser.model.Browser.java

/**
 * From map.//  ww w.  j  a v a2 s  .  co  m
 *
 * @param m
 *            the m
 * @return the user agent
 */
public static Browser fromMap(Map<String, String> m) {
    return new Browser(m.get("family"), m.get("major"), m.get("minor"), m.get("patch"));
}

From source file:io.gromit.uaparser.model.OS.java

/**
 * From map./*www  .  j a  v a  2 s  . co m*/
 *
 * @param m
 *            the m
 * @return the os
 */
public static OS fromMap(Map<String, String> m) {
    return new OS(m.get("family"), m.get("major"), m.get("minor"), m.get("patch"), m.get("patch_minor"));
}

From source file:Main.java

public static String get(String key) {
    Map<String, String> values = threadLocals.get();
    if (values == null) {
        return null;
    }/*  w w  w .j a  v  a  2  s  . c om*/
    return values.get(key);
}