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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:07:10+00:00 2026-05-14T23:07:10+00:00

I need to have a UserProfile class that it’s just that, a user profile.

  • 0

I need to have a UserProfile class that it’s just that, a user profile. This user profile has some vital user data of course, but it also needs to have lists of messages sent from the user friends.

I need to save these messages in LinkedList, ArrayList, HashMap and TreeMap. But only one at a time and not duplicate the message for each data structure. Basically, something like a dynamic variable type where I could pick the data type for the messages.

Is this, somehow, possible in Java? Or my best approach is something like this? I mean, have 2 different classes (for the user profile), one where I host the messages as Map<K,V> (and then I use HashMap and TreeMap where appropriately) and another class where I host them as List<E> (and then I use LinkedList and ArrayList where appropriately). And probably use a super class for the UserProfile so I don’t have to duplicate variables and methods for fields like data, age, address, etc…

Any thoughts?

  • 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-14T23:07:11+00:00Added an answer on May 14, 2026 at 11:07 pm

    I ended up using what I described on the first post:

    Is this, somehow, possible in Java? Or
    my best approach is something like
    this? I mean, have 2 different classes
    (for the user profile), one where I
    host the messages as Map (and
    then I use HashMap and TreeMap where
    appropriately) and another class where
    I host them as List (and then I use
    LinkedList and ArrayList where
    appropriately). And probably use a
    super class for the UserProfile so I
    don’t have to duplicate variables and
    methods for fields like data, age,
    address, etc…

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

Sidebar

Related Questions

I attached a UserProfile class to User this way: class UserProfile(models.Model): url = models.URLField()
I have the following models: class Post(models.Model): message = models.TextField() (etc.) class UserProfile(models.Model): user
I have 2 Models: # user.rb class User < ActiveRecord::Base has_one :profile, :dependent =>
I have a webpage that requires login. Once a user has logged in I
I need to have a thread signal another if the user wishes to interrupt
I have a few models that need to have custom find conditions placed on
According to Facebook graph API we can request a user profile picture with this
We have need for a rating system in a project we are working on,
I have need to select a number of 'master' rows from a table, also
I need to have a summary field in each page of the report and

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.