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

  • SEARCH
  • Home
  • 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 8215171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:41:45+00:00 2026-06-07T11:41:45+00:00

I use HashMap<String, ArrayList<String>> in Java. When input value is comes, For example, input

  • 0

I use HashMap<String, ArrayList<String>> in Java.

When input value is comes,

For example, input value is [1, "stack"], [2, "over"], [1, "flow"]…..

I want to enter value [1, ["stack", "flow"]], [2, "over"] in HashMap.

But key value is duplicate. So, HashMap was overwrite.

So, What can I do?

  • 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-06-07T11:41:47+00:00Added an answer on June 7, 2026 at 11:41 am

    Try a Guava Multimap:

    The traditional way to represent a graph in Java is Map<V, Set<V>>, which is awkward in a number of ways. Guava’s Multimap framework makes it easy to handle a mapping from keys to multiple values.

    A ListMultimap will map keys to a List of values, keeping track of their order, while a SetMultimap will map keys to a Set of distinct values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started learning Java. When would I use a HashMap over a TreeMap?
I have a hashmap which I want to copy for other use. But whenever
I need to use a HashMap of the form <String, ArrayList<String>> that is going
I'm just starting to learn to use HashMap and reading the java tutorial, but
I am new to java and have a question myBooks = new ArrayList<HashMap<String,Object>>(); What
package com.VRG; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import android.app.Activity; import android.content.Context; import android.media.MediaPlayer;
I have a HashMap. The key will be a string and value can be
If I have a type ArrayList<HashMap<String,String>> keys = functionWhichReturnsThisType(); How can I iterate through
If i use: HashMap<String, Integer> test = new HashMap<String, Integer>(); Or i use: HashMap
I need to use java-legacy code with the following method: public void doit(Map <String,

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.