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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:00:34+00:00 2026-05-31T14:00:34+00:00

Possible Duplicate: Why is softKeys() deprecated in Guava 10? The reason why MapMaker.softKeys() is

  • 0

Possible Duplicate:
Why is softKeys() deprecated in Guava 10?

The reason why MapMaker.softKeys() is deprecated in JavaDoc:

Use softValues to create a memory-sensitive map, or weakKeys to create
a map that doesn’t hold strong references to the keys. This method is
scheduled for deletion in January 2013.

This method is broken. Maps with soft keys offer no functional advantage over maps with weak keys, and they waste memory by keeping
unreachable elements in the map. If your goal is to create a
memory-sensitive map, then consider using soft values instead.

Specifies that each key (not value) stored in the map should be
wrapped in a SoftReference (by default, strong references are used).
Softly-referenced objects will be garbage-collected in a globally
least-recently-used manner, in response to memory demand.

I don’t understand why soft value prefers over soft key? Any scenario? MapMaker.softValues() is still available. 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-31T14:00:36+00:00Added an answer on May 31, 2026 at 2:00 pm

    Maps with soft and weak items have two major use cases:

    • Caches. A map with soft values can act as a memory-sensitive cache. Due to semantics of soft reference entries of the cache are collected when free memory is needed.

    • Canonicalizing mappings. Sometimes you need to associate additional property (a value) with the existing object (a key). This association shouldn’t prevent the key from being collected, and it doesn’t make sense after key is collected. Such an association can be implemented as a map with weak keys.

    Note that the use of soft keys instead of weak keys in the latter case doesn’t make any sense and causes unnecessary memory usage, so that soft keys have no practical use, that’s why they are deprecated.

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

Sidebar

Related Questions

Possible Duplicate: Create Generic method constraining T to an Enum Is there any reason
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: std::string and its automatic memory resizing I am just curious, how are
Possible Duplicate: how to use foursquare API in android application? This is a question
Possible Duplicate: When should you use 'friend' in C++? I see a lot of
Possible Duplicate: Why does ReSharper want to use 'var' for everything? I have ReSharper
Possible Duplicate: How do I create a nice-looking DMG for Mac OS X using
Possible Duplicate: How to: URL re-writing in PHP? How can a website use an
Possible Duplicate: How to minify php page html output? Any reason not to strip
Possible Duplicate: Delphi XE2: Is it possible to create Mac GUI applications without FireMonkey?

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.