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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:20:45+00:00 2026-05-29T05:20:45+00:00

I have a requirement like there is an item A that has several sub

  • 0

I have a requirement like there is an item A that has several sub items like a1,b1,c1… and each sub-item has in turn several sub-items like {a11,a12,a13…} which correspond to a1 and {b11,b12,b13..} which correspond to b1. So, its basically like a tree structure with item A as the root. Now, there is some time-stamp associated with each item and its sub-items. The time-stamp is different for all these items and sub-items. I need to find the item/sub-item with the latest time-stamp. How to proceed to solve this in java. Im kind of new to using data structures.

  • 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-29T05:20:46+00:00Added an answer on May 29, 2026 at 5:20 am

    Use TreeMap

    It will suit your need. Here is a sample program from java.samples.com

    // Create a tree map 
    TreeMap tm = new TreeMap(); 
    // Put elements to the map 
    tm.put("John Doe", new Double(3434.34)); 
    tm.put("Tom Smith", new Double(123.22)); 
    tm.put("Jane Baker", new Double(1378.00)); 
    tm.put("Todd Hall", new Double(99.22)); 
    tm.put("Ralph Smith", new Double(-19.08)); 
    // Get a set of the entries 
    Set set = tm.entrySet(); 
    // Get an iterator 
    Iterator i = set.iterator(); 
    // Display elements 
    while(i.hasNext()) { 
    Map.Entry me = (Map.Entry)i.next(); 
    System.out.print(me.getKey() + ": "); 
    System.out.println(me.getValue()); 
    } 
    System.out.println(); 
    // Deposit 1000 into John Doe's account 
    double balance = ((Double)tm.get("John Doe")).doubleValue(); 
    tm.put("John Doe", new Double(balance + 1000)); 
    System.out.println("John Doe's new balance: " + 
    tm.get("John Doe"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in JTable and I have a requirement like this. Say There
I have requirement like, suppose I have a 'property' table which has 'ListingKey' field
There is a requirement to have not-so-trivial dynamic list, each record of which consists
I have one requirement that I need to mark the table item when the
I have the requirement that whenever there is a model get's added/changed/deleted, it should
I would like to know what generic requirements are there to have Eclipse headless
I have requirement as following like showing ABPeoplePickerNavigationController in tabbar based application. I researched
I have a requirement. Given say Test1,Test2, I have to perform a like operation.
In our project we have requirement that, after receiving sms message from third party
i have a requirement in which i have a container div that contains 3

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.