Java 8 LinkedHashMap - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LinkedHashMap class.

This code example shows how to use the following methods:
 * @author crazybob@google.com (Bob Lee) 
 */ 
public class ToStringBuilder { 
 
    // Linked hash map ensures ordering. 
    final Map<String, Object> map = new LinkedHashMap<String, Object>();
 
    final String name;
 
    public ToStringBuilder(String name) {
        this.name = name;
    } 
 
    public ToStringBuilder(Class type) {
        this.name = type.getSimpleName();
    } 
 
    public ToStringBuilder add(String name, Object value) {
        if (map.put(name, value) != null) {
            throw new RuntimeException("Duplicate names: " + name);
10
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        if(log.message.startsWith("No MDC")) {
            mdc = Collections.emptyMap();
        } else if(log.message.equals("Null MDC")) {
            mdc = null;
        } else { 
            mdc = new LinkedHashMap<String, Object>();
            mdc.put("messageLength", log.message.length());
        } 
        logger.setMDC(mdc);
 
        switch (log.level()) {
            case 1: 
                logger.error(log.message);
                break; 
            case 2: 
                logger.warning(log.message);
                break; 
            case 3: 
                logger.info(log.message);
                break; 
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @author crazybob@google.com (Bob Lee) 
 */ 
public class ToStringBuilder { 
 
    // Linked hash map ensures ordering. 
    final Map<String, Object> map = new LinkedHashMap<>();
 
    final String name;
 
    public ToStringBuilder(String name) {
        this.name = name;
    } 
 
    public ToStringBuilder(Class type) {
        this.name = type.getSimpleName();
    } 
 
    public ToStringBuilder add(String name, Object value) {
        if (map.put(name, value) != null) {
            throw new RuntimeException("Duplicate names: " + name);
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:put
 
    } 
 
    @Test 
    public void hkeys() { 
	Map<String, String> hash = new LinkedHashMap<String, String>();
	hash.put("bar", "car");
	hash.put("car", "bar");
	jedis.hmset("foo", hash);
 
	Set<String> keys = jedis.hkeys("foo");
	Set<String> expected = new LinkedHashSet<String>();
	expected.add("bar");
	expected.add("car");
	assertEquals(expected, keys);
 
	// Binary 
	Map<byte[], byte[]> bhash = new LinkedHashMap<byte[], byte[]>();
	bhash.put(bbar, bcar);
	bhash.put(bcar, bbar);
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * Holds information about a permission attachment on a {@link Permissible} 
 * object 
 */ 
public class PermissionAttachment { 
    private PermissionRemovedExecutor removed;
    private final Map<String, Boolean> permissions = new LinkedHashMap<String, Boolean>();
    private final Permissible permissible;
    private final Plugin plugin;
 
    public PermissionAttachment(Plugin plugin, Permissible Permissible) {
        if (plugin == null) {
            throw new IllegalArgumentException("Plugin cannot be null");
        } else if (!plugin.isEnabled()) {
            throw new IllegalArgumentException("Plugin " + plugin.getDescription().getFullName() + " is disabled");
        } 
 
        this.permissible = Permissible;
        this.plugin = plugin;
    } 
 
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:put
 
  public UnicodeReader(InputStream in, String encoding) {
    pushbackReader = new PushbackInputStream(in, BOM_SIZE);
    this.encoding = encoding;
 
    BOMS = new LinkedHashMap<String, byte[]>(5);
    BOMS.put("UTF-8", new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF });
    BOMS.put("UTF-32BE", new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0xFE, (byte) 0xFF });
    BOMS.put("UTF-32LE", new byte[] { (byte) 0xFF, (byte) 0xFE, (byte) 0x00, (byte) 0x00 });
    BOMS.put("UTF-16BE", new byte[] { (byte) 0xFE, (byte) 0xFF });
    BOMS.put("UTF-16LE", new byte[] { (byte) 0xFF, (byte) 0xFE });
  } 
 
  public String getEncoding() {
    try { 
      return reader.getEncoding();
    } catch (NullPointerException e) {
      return null; 
    } 
  } 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
public class Sharded<R, S extends ShardInfo<R>> { 
 
    public static final int DEFAULT_WEIGHT = 1;
    private TreeMap<Long, S> nodes;
    private final Hashing algo;
    private final Map<ShardInfo<R>, R> resources = new LinkedHashMap<ShardInfo<R>, R>();
 
    /** 
     * The default pattern used for extracting a key tag. The pattern must have 
     * a group (between parenthesis), which delimits the tag to be hashed. A 
     * null pattern avoids applying the regular expression for each lookup, 
     * improving performance a little bit is key tags aren't being used. 
     */ 
    private Pattern tagPattern = null;
    // the tag is anything between {} 
    public static final Pattern DEFAULT_KEY_TAG_PATTERN = Pattern
            .compile("\\{(.+?)\\}");
 
    public Sharded(List<S> shards) {
        this(shards, Hashing.MURMUR_HASH); // MD5 is really not good as we works
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
	private final ServletContext servletContext;
 
	private final String servletName;
 
	private final Map<String, String> initParameters = new LinkedHashMap<String, String>();
 
 
	/** 
	 * Create a new MockServletConfig with a default {@link MockServletContext}. 
	 */ 
	public MockServletConfig() { 
		this(null, ""); 
	} 
 
	/** 
	 * Create a new MockServletConfig with a default {@link MockServletContext}. 
	 * @param servletName the name of the servlet 
	 */ 
	public MockServletConfig(String servletName) {
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    private Class<?> servletClass;
    private Servlet servlet;
    private String servletName;
    private boolean forceInit;
    private final List<String> urlMappings = new ArrayList<>();
    private final Map<String, String> initParams = new LinkedHashMap<>();
 
    public Class<?> getServletClass() {
        return servletClass;
    } 
 
    public void setServletClass(final Class<?> servletClass) {
        this.servletClass = servletClass;
    } 
 
    public Servlet getServlet() { 
        return servlet;
    } 
 
    public void setServlet(final Servlet servlet) {
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
	private final ServletContext servletContext;
 
	private final String servletName;
 
	private final Map<String, String> initParameters = new LinkedHashMap<String, String>();
 
 
	/** 
	 * Create a new MockServletConfig with a default {@link MockServletContext}. 
	 */ 
	public MockServletConfig() { 
		this(null, ""); 
	} 
 
	/** 
	 * Create a new MockServletConfig with a default {@link MockServletContext}. 
	 * @param servletName the name of the servlet 
	 */ 
	public MockServletConfig(String servletName) {
8
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Java 8 LinkedHashMap Questions & Answers:

See Code Examples for Java 8 LinkedHashMap Methods: