Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By JosAH

Thread: want to remove unused (Let us say for 10 min) objects from hashtable.

  1. #1
    RaviMaroju is offline Member
    Join Date
    Oct 2013
    Posts
    1
    Rep Power
    0

    Question want to remove unused (Let us say for 10 min) objects from hashtable.

    Hi Java People,

    i want to implement catching mechanism using the Hash-table class. Here's how: When i need an object, first check to see if it's in the Hashtable. If the required object isn't there, create a new instance of it and put it into the Hash-table. if it is available i will reuse that object.

    and if the object is no longer in use, i want to remove the object from hash-table.

    any suggestion would be highly appreciated.

    Thanks.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,651
    Blog Entries
    7
    Rep Power
    21

    Default Re: want to remove unused (Let us say for 10 min) objects from hashtable.

    Maybe a WeakHashMap object can be of help.

    kind regards,

    Jos
    masijade likes this.
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 2
    Last Post: 04-16-2013, 02:00 PM
  2. Hashtable question. Getting info from a hashtable
    By sindrem in forum New To Java
    Replies: 4
    Last Post: 01-19-2012, 05:00 PM
  3. How do I remove objects from an Array in java?
    By hamed in forum New To Java
    Replies: 3
    Last Post: 09-08-2010, 01:20 PM
  4. How to remove "unused" space in JMenu
    By nowy in forum AWT / Swing
    Replies: 13
    Last Post: 12-07-2009, 03:27 PM
  5. how to find unused jars??
    By orchid in forum Eclipse
    Replies: 4
    Last Post: 06-08-2007, 10:35 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •