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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:30:41+00:00 2026-05-11T09:30:41+00:00

I am working on querying the address book via J2ME and returning a custom

  • 0

I am working on querying the address book via J2ME and returning a custom Hashtable which I will call pimList. The keys in pimList {firstname, lastname} maps to an object (we’ll call this object ContactInfo) holding (key, value) pairs e.g. work1 -> 44232454545, home1 -> 44876887787

Next I take firstName and add it into a tree. The nodes of the tree contains the characters from the firstName. e.g. ‘Tom’ would create a tree with nodes:

'T'->'o'->'m'-> ContactInfo{ 'work1' -> '44232454545', 'home1' -> '44876887787' } 

So the child of the last character m points to the same object instance in pimList. As I understand it, the purpose of WeakReferences is to that its pointer is weak and the object it points to can be easily GC’ed. In a memory constraint device like mobile phones, I would like to ensure I don’t leak or waste memory. Thus, is it appropriate for me to make:

  1. pimList‘s values to be a WeakReference
  2. The child of node ‘m’ to point to WeakReference

?

  • 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. 2026-05-11T09:30:42+00:00Added an answer on May 11, 2026 at 9:30 am

    I am not sure if the WeakMap is the right thing here. If you do not hold strong references anywhere in your application, the data in the map will disappear nearly immediately, because nobody is referencing it.

    A weak map is a nice thing, if you want to find things again, that are still in use elsewhere and you only want to have one instance of it.

    But I might not get your data setup right… to be honest.

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

Sidebar

Related Questions

I'm working on a Silverlight page which has several modules for querying and plotting
I'm working on a project that uses several languages: SQL for querying a database
I'm working with the criteria API, querying against a mapping file that I cannot
I am working on a project that does a lot of querying and the
I'm working on a software that does extensive queries to a database which is
While I've been working with querying SQL databases for a while, I'm still quite
I'm working on Nagios plugin to monitor our rsyslog server, which is back-ended into
I am working on an android app in which I am using some Native
I'm working on a Wake on LAN service that will run from a web
I am in the process of learning MySQL and querying, and right now working

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.