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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:35:50+00:00 2026-05-28T00:35:50+00:00

I am looking for a Map implementation that returns the value associated with the

  • 0

I am looking for a Map implementation that returns the value associated with the requested key, or if not present returns the closest value, higher or lower as requested (along with the actual key, perhaps as a Map.Entry).

For example if the Map contained the following String key/value pairs:
alpha:AYE, beta:BEE, charlie:CEE, delta:DEE
and you ask for “Next higher” for “canada” you would get back charlie:CEE

Of course if you ask for the Next higher or Next lower for “charlie” you would get back charlie:CEE

It should use a comparator, so that if it contains Number keys 1, 2, 3 and I request Next higher for 1.4, it would return the 2 key.

  • 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-28T00:35:51+00:00Added an answer on May 28, 2026 at 12:35 am

    Use a NavigableMap:
    http://docs.oracle.com/javase/6/docs/api/java/util/NavigableMap.html

    In particular, use floorEntry or ceilingEntry or a combination.

    TreeMap is an instance of NavigableMap, so you can use that:
    http://docs.oracle.com/javase/6/docs/api/java/util/TreeMap.html

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

Sidebar

Related Questions

I'm looking for a Map implementation that iterates over the key-value pairs in the
I'm looking for an implementation of java.util.Map that has a method that will return
I'm looking for a tool that can map the relationships in my database in
I'm looking for a way to map some hot-keys to delete the line that
I was looking for a bidirectional map implementation in Java, and stumbled upon these
I'm looking for an on-disk implementation of java.util.Map . Nothing too fancy, just something
I'm looking for a Java class with the characteristics of C++ std::map's usual implementation
I've been looking for a proper implementation of hash map in R, with functionalities
Is there a simple Map-Reduce library or implementation for .NET that allows a task
I am looking for a robust Map in Java, where the key lookup would

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.