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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:15:59+00:00 2026-06-10T05:15:59+00:00

I have a map like this as shown below… Key Value 23 20 32

  • 0

I have a map like this as shown below…

Key Value
23 20
32 20 (20+20 =40 , min=23 max=32)
43 18
45 24 (24+18 =42 , since 42 >40 so here min and max will be same that is 43
47 10
56 6 (24 +10 +6 =40) so here min =45 and max = 56
49 2
47 12

so as shown above there will be final constant named split whose value is 40

final int SPLIT = 40; //this will be configurable as it value can be changed.

so I have to implmenet the logic such as that if the value of the map reaches to 40
then first key of the map from where the calculation started and he key where exactly it reaches to 40wilkl be choosen as min and max also explained above

besides this care need to be taken the\at if sum reaches more than 40 then we have to ignore it and taking the previous value itself as min amd max in tha case min and max will be equal.

Please advise how to achieve the same through java in map

  • 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-10T05:16:01+00:00Added an answer on June 10, 2026 at 5:16 am

    I would redesign your application so it doesn’t need a global lock. Implement your system so only one JVM need the lock, and every other JVM talks to it do what is needed.

    There are many alternatives, using ServerSocket, file locks, data locks, but IMHO these are much more difficult to get right or efficient.

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

Sidebar

Related Questions

I have a Map that uses a Set for the key type, like this:
I have something like this: Map<String, String> myMap = ...; for(String key : myMap.keySet())
I have something like this: [{'date': 1, 'value':5}, {'date':2,'value':3}, ...] and want to map
I have a block of code in my view like this: <% @map[value].each do
I have a a map that looks like this: public class VerbResult { @JsonProperty("similarVerbs")
I have a map array with objects stuffed with variables looking like this: var
We have several areas where code like this can be seen public Map extractData(ResultSet
I have a class like this: class MyClass{ public: MyClass(int Mode); private: std::map <
I have a recursive data type like this: template<typename T> struct SomeType { std::map<T,
I have class that looks like this: class A { public: class variables_map vm

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.