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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:15:19+00:00 2026-05-17T18:15:19+00:00

I want to know a data structure for storing values of tags. My XML

  • 0

I want to know a data structure for storing values of tags. My XML structure is :

<personaldetails>
    <name>Michael</name>
    <age>28</age>
    <gender>Male</gender>
    <address>123 Streeet 7</address>
    <country>India</country>
    <pincode> 1234877</pincode>
    <contactno>35646445</contactno>
    <emailid>michael@abc.com</emailid>
</personaldetails>

I want to store the values at a single place using data structure.Presently i am using setter and getter methods for retrieving values which is making my code large.
Can someone suggest something?

  • 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-17T18:15:19+00:00Added an answer on May 17, 2026 at 6:15 pm

    Getters and setters on an object have the advantage of type safety. For example if you tried to write the code getContactN then the compiler would give you an error. So although it might make your code long, getters and setters are good.

    An alternative would be to use a map e.g. Map<String,String> to store the values. This is more general – you can insert whatever key you like – and is less code, however it doesn’t give you the static analysis benefits of getters and setters. If you mis-spell something you will only discover it when you execute that bit of code – and if it’s in an if the code might not always get executed and you might miss it.

    There would also be performance differences between using getters/setters and a map, however, i imagine in 99% of applications they would be irrelevant so it’s not worth pointing out here. If that code becomes a bottleneck you could put timings in to see which approach is better – but do that only if you can verify you have performance problems in this area, otherwise just use whichever technique is more maintainable and easier for you.

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

Sidebar

Related Questions

I want to know that which data structure suits best for storing the family
Specifically I want to know what the data structure for the imports (idata) section
I have a vector<set<char> > data structure (transactions database) and I want to know
i want to use a matrix type data structure for storing and looking up
I want to know if it is possible to stream data from the server
Also I want to know how to add meta data while indexing so that
I just want to know a easy way to extract all data with same
I'm trying to display data from a database and I want to know what
I am reading a large data stream using lazy bytestrings, and want to know
I want to insert data into a table where I don't know the next

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.