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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:11:20+00:00 2026-06-02T20:11:20+00:00

It works like this: Set<Integer> nums = numMap.get(id); nums.add(new Integer(0)); // now do i

  • 0

It works like this:

Set<Integer> nums = numMap.get(id);
nums.add(new Integer(0));
// now do i have to:
numMap.put(id,nums)?
// or is it already stored?

regards && tia
noircc

  • 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-02T20:11:23+00:00Added an answer on June 2, 2026 at 8:11 pm

    You don’t have to put it back, unless you make a deep clone of it. Everything works based on references in Java.

    You can always test this by writing a simple program.

    public static void main(String... args) {
        Map<Integer, Set<Integer>> numMap = new HashMap<Integer, Set<Integer>>();
    
        Set<Integer> set = new HashSet<Integer>();
        set.add(10);
    
        numMap.put(0, set);
    
        System.out.println("Map before adding is " + numMap);
    
        set.add(20);
    
        System.out.println("Map after adding is " + numMap);
    }
    

    Which prints

    Map before adding is {0=[10]}
    Map after adding is {0=[20, 10]}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a line in my SQL Stored Procedure that looks like this (works
So, I have a class with a constructor like this: public FilterList(Set<Integer> labels) {
I have some code (which works fine) that looks something like this: int integer
We have a reporting solution that works like this. User orders the report to
I have a scene, called testScene, it works like this: @interface testScene : myScene
I have a formula like this which works fine on Excel/OOCalc applications: =SUMPRODUCT(--($Panels.$A$5:$A$6999=K$80);--($Panels.$B$5:$B$6999=K$81);INDEX($Panels.$C$5:$J$6999;0;MATCH(Voc;$Panels.$C$3:$J$3;0))) Since
I have to do something like this in C. It works only if I
It looks like this template tag works like a charm for most people: http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/
I need a class that works like this: >>> a=Foo() >>> b=Foo() >>> c=Foo()
I want a debug function-macro that works like this: int myVar = 5; PRINTVAR(myVar);

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.