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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:54:22+00:00 2026-05-13T20:54:22+00:00

I need to implement a MultiKeyMap, where I can have 2 keys and a

  • 0

I need to implement a MultiKeyMap, where I can have 2 keys and a value. I was looking to Apache collections MultiKeyMap, but I’m not sure if it is the best one. My problem is that I need to use this MultiKeyMap in a Web environment, and the Apache implementation is not thread safe (and Collections.synchronizedMap(..) doesn’t work).

Any idea?
Thanks!

  • 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-13T20:54:23+00:00Added an answer on May 13, 2026 at 8:54 pm

    Yeah, as andrew007 suggests, you can use MultiKey. If I were you though, I will implement my own class, name it something like BiKey, or even something more meaningful. One of the reason is that MultiKey is not generified.

    To summarize, why don’t you do something like:

    ConncurrentMap<BiKey,Stuff> map = new ConcurrentHashMap<BiKey,Stuff>();
    
    class BiKey{
        Key1 k1;
        Key2 k2;
        //let equals return k1.equqls&&k2.equals and implement hashCode accordingly
     }
    

    ConcurrentHashMap scales really nice, and it has some useful operations that can come in handy.

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

Sidebar

Related Questions

I need to implement portable code, but I do not know how to deal
I need to implement the website visitor count Usercontrol.Can any one help me regarding
I need to implement an efficient excel-like app. I'm looking for a data structure
I need to implement a one-to-one videoconferencing solution server-based, runnable by browser, free (or
need to implement a global error handling, so maybe you can help out with
I need to implement an OS file chooser with php but I don't know
I need to implement the following flow in my application: the user can click
Need to implement functionality similar to what dotdotdot jQuery plugin does but cannot use
I need to implement undo-redo functionality in my project. But it is very complex
I need to implement a basic FIFO queue of objects. Whats the best built-in

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.