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 7940019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:15:42+00:00 2026-06-03T23:15:42+00:00

The data in hashtable is getting overridden for the same key.I am trying to

  • 0

The data in hashtable is getting overridden for the same key.I am trying to add ‘n’ number of data against a same key at different intervals,the data added to hashtable peviously is getting overridden,how to solve this issue?

if (value == RepeatRule.DAILY) {

                            setHashRepeatData(repDates, eventBean,
                                    listRepeatEvents);

                        }
                        if (value == RepeatRule.WEEKLY) {

                            setHashRepeatData(repDates, eventBean,
                                    listWeekEvents);
                        }

private void setHashRepeatData(Vector repDates, EventData eventBean,
            Vector listOfRepeatData) {

        if (repDates != null) {
            System.out.println("the size of repDates is :" + repDates.size());
            System.out.println("summ" + eventBean.getSummary());
            listOfRepeatData.addElement(eventBean);
            for (int i = 0; i < repDates.size(); i++) {
                String currentRepDate = (String) repDates.elementAt(i);
                System.out.println("currentRepDate" + currentRepDate);

                listUserEvents.put(currentRepDate, listOfRepeatData);

            }
        }

    }

I am calling the above method at different intervals and trying to set the data for same key.I am not getting how to solve the issue.

  • 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-03T23:15:44+00:00Added an answer on June 3, 2026 at 11:15 pm

    This would be a sample implementation of what you want to achieve, if you do it yourself:

    // I took a set because I wanted have the inputs sorted
    HashMap<String, Set<String>> var = new HashMap<String, Set<String>>();
    
    String key= "key";
    String value = "value";
    
    if(var.containsKey(key)){
    // the set is already there we can proceed to add the value
    } else {
        //first time you have to create the List
        var.put(key, new TreeSet<String>());
    }
    var.get(key).add(value);
    

    You will have to modify it accordingly to your case like:

    HashMap<String, Vector<String>> var = new HashMap<String, Vector<String>>();
    
    String key= "key";
    String value = "value";
    
    if(var.containsKey(key)){
    // the set is already there we can proceed to add the value
    } else {
        //first time you have to create the List
        var.put(key, new Vector<String>());
    }
    var.get(key).addElement(value);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Hashtable I want to have multiple objects mapped to the same key. E.g.
I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException:
When I add some items into a Java Hashtable , their order is different
I have some data and I have added them to Hashtable in some orders
At various places, I've read that STL does not provide hashtable and union data
JavaScriptSerializer s = new JavaScriptSerializer(); result = s.Deserialize<Hashtable>(data); Error is thrown if data is
During last three days I have been trying to solve Project Euler 15 in
I am trying to write an implementation of HashTable in C and I am
Initially I use hashtable in my android application. The key point I love hashtable
I am using a hashtable to store key-value pairs and I initialize this hashtable

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.