Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5943783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:26:42+00:00 2026-05-22T16:26:42+00:00

Ok so i am new to these HashMaps but have some idea about LinkedLists

  • 0

Ok so i am new to these HashMaps but have some idea about LinkedLists and HashMaps.
It would be great if you could give me some simple explanation regarding LinkedHashMap and as in the titile does this mean we are explicitly defining it to be of some type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:26:43+00:00Added an answer on May 22, 2026 at 4:26 pm

    A LinkedHashMap is a combination of
    hash table and linked list. It has a
    predictable iteration order (a la
    linked list), yet the retrieval speed
    is that of a HashMap. The order of the
    iteration is determined by the
    insertion order, so you will get the
    key/values back in the order that they
    were added to this Map. You have to be
    a bit careful here, since re-inserting
    a key does not change the original
    order.

    k stand for Key and v for Value.

    /*
      Simple Java LinkedHashMap example
      This simple Java Example shows how to use Java LinkedHashMap.
      It also describes how to add something to LinkedHashMap and how to
      retrieve the value added from LinkedHashMap.
    */
    
    import java.util.LinkedHashMap;
    
    public class JavaLinkedHashMapExample {
    
    public static void main(String[] args) {
    
    //create object of LinkedHashMap
    LinkedHashMap lHashMap = new LinkedHashMap();
    
    /*
      Add key value pair to LinkedHashMap using
      Object put(Object key, Object value) method of Java LinkedHashMap class,
      where key and value both are objects
      put method returns Object which is either the value previously tied
      to the key or null if no value mapped to the key.
      */
    
    lHashMap.put("One", new Integer(1));
    lHashMap.put("Two", new Integer(2));
    
    /*
      Please note that put method accepts Objects. Java Primitive values CAN NOT
      be added directly to LinkedHashMap. It must be converted to corrosponding
      wrapper class first.
      */
    
    //retrieve value using Object get(Object key) method of Java LinkedHashMap class
    Object obj = lHashMap.get("One");
    System.out.println(obj);
    
    /*
      Please note that the return type of get method is an Object. The value must
      be casted to the original class.
      */
    
    
    }
    }
    /*
    Output of the program would be
    1
    */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a clarification about some Java code: What's the difference between these codes,
I'm rather new to these could someone explain the significance (of the following code)
I have a dijit.form.NumberTextBox input field that starts out with these parms: new dijit.form.NumberTextBox({
I have the following code which adds some arrays to a hashmap but then
Have to erase some of the details of this, but basically I'm trying to
I have one Map that contains some names and numbers Map<String,Integer> abc = new
Basically I would like to have some dictionary that is an abstaction over legacy
I'm using the asmack XMPP with Android, but I have a problem. I would
I'm kind of new to these things. I do not know what command line
I am trying to figure out exactly what these new fangled data stores such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.