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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:23:08+00:00 2026-05-25T19:23:08+00:00

How do I select an object by the an int inside it? Here is

  • 0

How do I select an object by the an int inside it?

Here is code:

String FolderName = result.getString ("name");
String FolderId = result.getString ("category_id");
String ParentId = result.getString ("parent_id");
int intFolderId = Integer.parseInt(FolderId);
int intParentId = Integer.parseInt(ParentId);
System.out.println( FolderId+" "+FolderName+" "+ParentId );

Map<Integer, Folder> data = new HashMap<Integer, Folder>();
Folder newFolder = new Folder(FolderName, intFolderId, intParentId);
data.put(newFolder.getId(), newFolder);

  for(Folder folder : data.values()) 
  {
    int parentId = folder.getParentFolderId();
    Folder parentFolder = data.get(parentId);
    if(parentFolder != null)
      parentFolder.addChildFolder(folder);
  }

How can I select an object with a parentID of 0 for example?

  • 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-25T19:23:09+00:00Added an answer on May 25, 2026 at 7:23 pm

    Your question is not very clear. You should edit it and try to better explain what you’re trying to do.

    I’ll make the assumption that you have a collection of objects, and you want to select the object using some sort of an ID. If that is the case you can use a java.util.Map implementation to store your objects.

    For example:

    Map<Integer, MyObject> map = new HashMap<Integer, MyObject>();
    map.put(object1.getId(), object1);
    map.put(object2.getId(), object2);
    //... and so on ...
    

    And you can retrieve the objects using:

    MyObject object = map.get(id);
    

    EDIT:

    How can I select an object with a parentID of 0 for example?

    Maintain a list of children in each Folder. I think you are already doing that, since you have used an addChildFolder() method. Then you simply get the Folder with ID 0 from the map. Its list of children will have parentID 0.

    The best way to organize your data structure will depend ultimately on what you’re trying to do. You may find this interesting.

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

Sidebar

Related Questions

I have a table like this: Item { int ItemID int ParentID string Name
I have the following query: SELECT o.id,o.name FROM object o WHERE ( o.description LIKE
Here is the code which compiles : int select_object = 0; if( select_object )
string sql=, sql2 = , rank=; int basic_wage, rent_allowance, seniority_allowance, overtime_rate; sql += select
I just learned something interesting. The add method for the javascript select object in
What object do you query against to select all the table names in a
I need to select 5 most recent rows from cached Dataview object, is there
How to use Linq to select and group complex child object from a parents
Can I return it as an object if I am doing a Select OneItem
i have the following code Private Sub select_color_Click(ByVal sender As System.Object, ByVal e As

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.