Need a java hashtable class that is more controlable

Hi,
I have a C hashtable code that I can easily remove an element in some specific bucket, and in some specific position of the linked list (for conflicted elelments). Also I can strictly specify the size of the hashtable, and the total elements in the hashtable.
However for java Hashtable class, it seems I don't have the flexibility to remove an element in some specific positions (like what I did in C) , also it seems I cannot exactly control the size of the hashtable.
Do I really need to translate my C code hashtable to my own Java Hashtable class to fulfill what I need? Or is there any better way to do it?
Many thanks!
TimY.

Sorry that I didn't explain my need clearly in the first message, let me try to do it now:
First, I need to fix the size of the hashtable because I don't want it consume too much of the memory. In my application, for example, I hope the maximum bucket size of my hash table less than 3000. And in each bucket, there are at most 10 conflicted elements are linked together, and they will be searched sequentially.
Second, if more elements need to be added to the hashtable but there are already 10 elements in the corresponding bucket, I would like to use some replacement algorithm like LRU, CLOCK to evict one element, and then put the new element there. This is the reason why I need to remove a specific element in a bucket.
Third, I wish the cost for lookup, add, remove is very low.
So should I use some other Java classes to implement my requirement, instead of using Java Hashtable class directly?
Many thanks for your prompt replies to my first message!
Tim.Y

Similar Messages

  • I need the Java IDoc Class Library

    Hi,
    I'm desperately looking for the Java IDoc Class Library. What for? I'm doing a project for university and I have a test version running on my own computer (Mini WAS 6.20 with the FlightBooking example installed). The SAP Service Marketplace is for registered customers only. Since I only have a test environment (mentioned above) I can't register there and download it.
    Could anyone please send me this library by mail, to [email protected] Since I don't know how big this package is: my mail provider has a 15MB/per single mail limit. If biiger, please split.
    Yes, I'm asking for much. But I'm pretty desperate and I have to get going, since I'm running out of time.
    If there are other ways to get this library, please tell.
    Thanks
    Jonny

    Hi Johannes
    The SAP Java IDoc Class Library consists of two parts, the SAP Java Base IDoc Class Library and the SAP Java Connector IDoc Class Library. The SAP Java Base IDoc Class Library provides an API which helps navigating, reading, filling, and modifying IDocs. This base package is middleware independent. Creating, sending, and receiving IDocs is middleware dependent. To make use of the SAP Java Base IDoc Class Library you will need an additional middleware dependent add-on package implementing the defined interfaces like the SAP Java Connector IDoc Class Library.
    The SAP JCo can be downloaded from the   
    https://websmp101.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000463649
    of SAP JCo. The SAP JCo package includes the software as well as documentation, tutorial, and examples. The SAP Java IDoc Class Library can be downloaded from the same URL, and then follow the link to SAP Java IDoc Class Library. The SAP Java IDoc Class Library packages include the software as well as documentation.

  • Need info on the class that is used for BUILHEADER Genil query

    Hi All,
    Can some one pls let me know the class that is called by executing the query BUILHEADER.
    I m facing a strange error, everytime when i search and open any account other than sold to party in WEBUI, I am noticing soldto party in the Roles Assignment block. But the business partner in the backend is not having hte role sold to party. i am not finding how this defaulting is happening automatically.
    Any pointers/clues on this will be very very helpful.
    Thanks,
    Udaya

    Hello Udaya,
    The class is CL_BUIL_HEADER Copy it and redifine method GET_RESULT_TABLE.
    then goto SPRO I'm not remember exactly where you should change the SAP class into yours.
    Sorry it was on ICWC5.0 and not CRM2007
    Eli Steklov
    Edited by: Eli Steklov on Jul 16, 2008 3:52 PM

  • Need to write a query that takes more than 2 minutes to execute

    Hi ,
    I am using Oracle 10g as my DataBase.
    I am writing a small program for Testing purpose , in that my requirement is to write a query that takes more than 2 minutes to execute .Right now i have only a small Table called as "Users" with very less data .
    Please let me know how can i achieve this thing ??
    Thanks .

    So please tell me , how can i achieve this . Thanks in advance .P. Forstman's example above will probably be more reliable, but here's an example of my idea - harder to control timing (untested)
    select count(*)
      from dba_objects o, dba_tables t, dba_tab_columns tc
    where o.object_name||'' = t.table_name||''
       and o.owner||'' = t.owner||''
      and t.table_name||'' = tc.table_name
      and t.owner||'' = tc.owner||''

  • Need help on downloading apps that are more than 20MB in size

    I can only download apps less than 20MB in size. If i want to download others that are larger than 20MB, i have to use wifi... But after I connected my phone to my home network and clicked on the app, I am still unable to download it... The only message that pops up is to prompt me to connect to wifi.... but I thought I have connected it already??! So now the apps are grey in colour and stuck at the "loading" stage... Does anyone know how I can solve this problem? Thanks.

    Hello, thanks for your answer... yups you are right, i went to the app store on the phone and the downloads started again.
    I have one that is 22MB, one 124MB and one 36MB.... but i have tried to download those which are above 40MB but they can work... I don't know what happened to thes 3 apps...
    Oh my, I have just started using iphone for 2weeks and i dun suppose my phone is out of space already?!! currently there are less than 40apps...
    And the problem is i can't delete these apps that are stuck? when i press and hold, there is no "cross" at the top left hand corner... and i tried to uncheck the boxes in itunes to "un-sync" them.... but the apps remain greyed out on my phone... do you have any other ways to delete them?
    Thanks alot!

  • HELP! I need audio CD burning software that features "gain" control...

    ...that ISN'T Roxio Toast!
    (I realise that this is not a question about iTunes specifically, but I wasn't sure where else to post this.)
    I burn a lot of compilation CDs for the car, and for years I used Roxio's Jam 2.5 and 2.6 because they allowed me to adjust the gain (volume) of each track for consistent volume overall. The software was light on features but it worked reliably and predictably. (Supposedly Jam 2.6 works with OS X 10.6.x, but I never could get it to launch.)
    I reluctantly purchased Toast Titanium (and have updated to 11.1), and while it technically works, the app is more than a little clunky, frustrating and half-baked. For example, the latest update appears to have fixed the "sticky" gain windows that would open far longer than needed, but now the software cannot navigate through ANY of my folders or hard drives after typing Command-O to open an existing Toast file. Pathetic! (Do they not test their own product at all?!)
    Can anyone recommend any other software that was designed specifically for burning audio CDs that features at least gain and crossfade controls? I'd love nothing more than to ditch Roxio products once and for all!
    Thanks in advance!!

    I would recommend at least downloading the trial version of Sound Studio and trying it out. I work for Freeverse (the publishers of Sound Studio). I asked around, and there have not been any complaints about the pitch adjuster in the latest version 3.5.5, AFAIK. You can adjust the pitch and tempo independently.
    The trial version is fully functional, and is only limited by the number of times you can launch the program (10 times).
    www.freeverse.com/soundstudio
    If you do try it out, I'd love to hear what you think of it.

  • HELP?! a class that implements .....  : java.util.Vector

    My instructions say this:
    In the constructor, create the collection object (Since java.util.List is an interface, you will need to instantiate a class that implements this interface: java.util.Vector or java.util.LinkedList or java.util.ArrayList).
    I know, this IS a homework assignment - I am not sure how to go about this. I DO have code so far up to this point, can anyone help?
    import dLibrary.*;
    import java.awt.Color;
    * @author Rob
    * @version 8/18/03
    public class PhrasesII extends A3ButtonHandler
            private A3ButtonWindow win;
            private ATextField stringAcceptor;
            private ALabel listOstrings;
            private ALabel inputString;
            private ALabel status;
            private java.awt.List display;
            private java.util.List collection;
    public PhrasesII()
            win = new A3ButtonWindow(this);
            stringAcceptor= new ATextField (50,420,200,25);
            stringAcceptor.place(win);
            listOstrings = new ALabel(100, 10, 100, 380);
            listOstrings.setFontSize(10);
            listOstrings.setText("List of Strings:");
            listOstrings.place(win);
            inputString = new ALabel(50,400,200,25);
            inputString.setFontSize(10);
            inputString.setText("Input String:");
            inputString.place(win);
            display = new java.awt.List();
            display.setLocation(200, 100);
            display.setSize(200, 250);
            display.setBackground(Color.lightGray);
            win.add(display, 0);
            win.setLeftText("Save");
            win.setMidText("Display");
            win.setRightText("Discard");
            win.repaint();
      public void leftAction()
        public void midAction()
        public void rightAction()

    I am getting a " can't resolve symbol" when I do thisYou have to either import java.util.ArrayList or specify it fully, e.g., "new java.util.ArrayList()".
    Is that the line that is causing you problems? The error message should give the line number.
    my instructions also say I have to use "interface
    java.util.List when declaring your reference" so I am
    confused about using "= new ArrayList();"What they're saying is that you want code like this:
    private java.util.List frogs;    // this is the reference declaration
    //... later on...
    frogs = new java.util.ArrayList();  // this isn't a declarationWhat this means is that when you declare a field or variable, you should declare its type to be an interface.
    But when you actually instantiate a value for that variable, then you should use a concrete class that implements that interface. (You have to; interfaces can't be instantiated.)
    This is good programming style for reasons I don't have the space to explain here.

  • How to access AM/VO instance from a Java Service class

    Hi,
    I have a Java service class that is loaded by Java ServiceLoader (http://download.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html) at run time, and I need to access database tables inside that service class. So is there any way that I can access AM/VO instances from that Java class in order to read database table? Thanks.
    Regards,
    K Hein

    You can access an application module with the the two methods below:
        YOURAppModule mAM;
        public void setUpAM()
            throws NamingException
            try
                String AMDefName = "YOUR_APP_DEF_NAME";
                Hashtable env = new Hashtable(2);
                env.put(JboContext.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
                env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
                ApplicationModule am = null;
                InitialContext ic = new InitialContext(env);
                ApplicationModuleHome home = (ApplicationModuleHome) ic.lookup(AMDefName);
                am = home.create();
                // Connect the AM to a database connection
                String jndiDB = "jdbc/HRDS";
                am.getTransaction().connectToDataSource(null, jndiDB, false);
                boolean connected = am.getTransaction().isConnected();
                mAM = (YOURAppModule) am;
            catch (NamingException nex)
                // do some error processing
                throw nex;
            catch (Exception eee)
                // do some error processing
                throw eee;
        public void tearDownAM()
            if (mAM != null)
                if (mAM .getTransaction().isConnected())
                    mAM .getTransaction().disconnect();
                    mAM .remove();
        }You find the YOUR_APP_DEF_NAME in your application module under 'Configurations' -> AppModuleJndiName.
    Make sure you tear down each AM you set up. Otherwise you are running out of resources pretty fast.
    Timo

  • Java Hashtables.

    Ok, the API documentation for Java Hashtables says that they use "open hashing". This means you can store two values under the same key- the storage space for each key is in some sort of collection, and it can be added to the collection. So, basically, that implies that code such as:
    java.util.Hashtable h = new java.util.Hashtable();
    h.put("A", "ABC");
    h.put("A", "DEF");
    System.out.println(h.get("A"));
    System.out.println(h.get("A"));
    System.out.println(h.get("A"));
    would add bot ABC and DEF to the hash key entry. Unfortunately, the get statements above all print out "DEF".
    The way I would get around it would be something like this:
    Hashtable h = new Hashtable();
    MyClass myInstance = new MyClass(1);
    //Assume that MyClass.getKey() returns the desired Key for the hashtable.
    if (h.containsKey(myInstance.getKey()){
    h.put(myInstance.getKey(new LinkedList(myInstance));
    else{
    ((List)(h.get(myInstance.getKey())).add(myInstance);
    (I understand that ArrayList probably isn't the most efficient collection to use here, but I'm just trying to show the basic workaround.)
    I have no problem working around this, however, the API documentation for it says,
    "Note that the hash table is open: in the case of a "hash collision", a single bucket stores multiple entries, which must be searched sequentially."
    This implies that the Hashtable entries are coded to automatically store multiple items. But, I don't see that implemented.
    In fact, if you think about it, if you have to store your own collections in the hashtable's entry table, there really isn't anything at all in the actual implementation of the hashtable class itself that makes it open.
    Like I said, I have no significant opposition to implementing such a workaround, however, the API leads me to believe that hashtable is implemented in a way that doesn't require me to, although the methods contained in it seem to show otherwise.
    Is there a better way? Or is the API inconsistent? Or is my interpretation of "open" and "closed" hashing off-beat?
    Thanks for the help guys,
    Scott

    Ok, the API documentation for Java Hashtables says
    that they use "open hashing". This means you can
    store two values under the same key- No, not under the same key, but under the same hashCode.
    the storage
    space for each key is in some sort of collection, and
    it can be added to the collection. So, basically,
    that implies that code such as:
    java.util.Hashtable h = new java.util.Hashtable();
    h.put("A", "ABC");
    h.put("A", "DEF");
    System.out.println(h.get("A"));
    System.out.println(h.get("A"));
    System.out.println(h.get("A"));
    would add bot ABC and DEF to the hash key entry.No, that's not correct. The key has be to unique, and "A".equals("A") == true.
    Kaj

  • Re: More control over html tags needed

    I have trying for a while to find an elegant solution to printing reports in such a way as to have headers and footers repeated on every printed page.
    <BR><BR><BR>
    The two main solutions seem to be either using PDF (using FOP) or controlling the size of the regions anually (by hardcoding heights etc.). I am confident that with more control over the html tags (or the ability to place my own) around certain areas the problem could be solved very simply with CSS.
    <BR><BR><BR>
    What I would like is a way to change the way that Apex treats table headers.
    <BR><BR><BR>
    Presently it places the headers within a tbody tag and the uses th for every column. Ideally I would like to see this changes from tbody to thead. Given that the chances of this happening in the near future are minimal (not something that I am upset about as it would not be logical to change such things every time someone wants things to suite them better), I would like to be able to place a tag either before or after the tbody tag.
    <BR><BR><BR>
    Something like:
    <BR><BR><BR>
    div id="tableheaders"
    <BR><BR><BR>
    If anyone knows how to do this your help will be greatly appreciated. Given that, printing repeated headings can be controlled relatively simply.

    Hello Andrew,
    I believe the following might be of help - placing <thead> and </thead> around headers
    Regards,
    Arie.

  • Need to use a webservice, which expects a Java Forminput class, in Apex

    Hi,
    I'm fairly new to webservices in Apex but have successfully created and used one.
    We now need to use a webservice that was created for a legacy system and expects a Java Forminput class as its second parameter.
    msg = webServ.request_Str(sessionId, frmInput); I do have some details of what the frmInput contains but my basic question to any Web Sevice and Java experts out there is can I take my form items and values and create something that looks like a Java Forminput to the Apex webservice call?
    Any hints on how to do this would be most welcome.
    Thanks,
    Chris
    PS Using Apex 3.2
    Edited by: phillips_chris on Oct 13, 2011 9:22 AM

    The '$' symbol cannot be used directly in SE91 message text. But you can create a message "Sales order does not meet the minimum net value of &" and then in the program call message like this:
    MESSAGE .... WITH '$10,000' .

  • Deploying java class that uses oraclexmlsql.jar

    Hi,
    I'm trying to deploy a java class that I wrote. It simply gets some data out of my oracle database as xml using the oraclexmlsql package. It works fine when I compile it within JDeveloper.
    When I try to deploy it JDeveloper gives out the following error:
    Errors in xmlquerydb:
    ORA-29521: refferenced name oracle/xml/sql/query/OracleXMLQuery could not be found
    loadjava: 1 errors
    I can't figure out why that happens. I have used other classes and deployed them as Java stored Procedure and they work fine.
    Thanks for help
    Andre

    I tried to load the oraclexmlsql.jar into the shema where I put my class. The classes from this jar were loaded but can not be compiled( apart from 3 ). I also tried loading my class into sys but I still can't compile it or the oraclexmlsql.jar classes.
    Is the xsu12.jar a collection of all the classes that are allready in Sys after the database install?
    I have noticed that on expanding the oraclexmlsql.jar file has a strange format and two classes classes are in the directory from which I expanded the jar. These two classes do not get a synonym on loading into the db. Could that have anything to do with it?
    Thanks for more help
    Andre

  • Java class that accesses the operating systems shell?

    i have been told by my boss to find a class that will allow him to send and recieve information to the operating systems shell, as in dos, if i do not find the solution i am to be fired, please help me....im jp...but for real help me out

    i have been told by my boss to find a class that will
    allow him to send and recieve information to the
    operating systems shell, as in dos, if i do not find
    the solution i am to be fired, please help me....im
    jp...but for real help me outIt doesn't seem that you have put yourself in a very good situation if you are about to be fired.
    At any rate I think you want to use the Process class. Look at the API documentations for java.lang.Runtime and java.lang.Process. Using Process you can launch other programs (like system ones that run in the console) and you can read and write to the process using the input and ooutput streams of the process.
    If you have more questions pleas be sure to post your formatted code so that we can be of more assistance.
    Good luck to you and have a happy day.

  • When I click on firefox I get a java script error that says "TypeError: Components.classes[TvtPwmComponent_CID] is undefined", what does that mean?

    Whenever I click on firefox, or when a pop-up occurs, I get a java script error that says, "TypeError: Components.classes[TvtPwmComponent_CID] is undefined". I don't know why. It first occurred while I was on ESPN while trying to watch college games live.

    This issue can be caused by an extension that isn't working properly.
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • What is the best charging cable for the iPad Air (that is not made by Apple)? I need a long cable (over 6ft or more). I also need the cable to be of high quality and the cord part of the cable to be made of strong material.

    What is the best charging cable for the iPad Air (that is not made by Apple)? I need a long cable (over 6ft or more). I also need the cable to be of high quality and the cord part of the cable to be made of strong material. Apple does not make one this long. Is there a cable out there that is sturdy like this and is safe to use?

    yes, but I'm trying to use my iPad to type notes (using pages) and I have the smart case which I use as a stand. I need a cable long enough to fit through the back of my desk and the charging brick for the iPad won't fit behind the desk. I have to put it on the floor and then the apple cables aren't long enough to reach.

Maybe you are looking for

  • IPod with colour display frozen in 'hold' mode

    My iPod with colour display has frozen whilst in 'hold' mode. Toggling 'hold' does not unlock 'hold'. Screen remains frozen despite following reset steps and searching he forums. Anyone got any suggestions or links for me to check out please ? Thanks

  • SAP CPS - Starting SAP RFC-Agent fails

    Dear Developers I try to start an SAP RFC-Agent for a specific SAP instance (which is one of the test environments) and a client in a Redwood Cronacle Repository Version 7.0.3 which fails. I get the following error message: Redwood Cronacle for SAP A

  • Can I have a paragraph (not a frame) upside down?

    Is it possible to create a paragraph style that makes the text go upside-down? I don't mean a text frame that goes upside-down or mirrored, but just aparagraph in running upside-up text.

  • HfmCopyAppCmd.exe

    Hi, Can any one help me on how to execute the HfmCopyAppCmd.exe. I prepared the soure and the destination UDL and the applications. Now how should I run. Do I need to create a batch file with HfmCopyAppCmd.exe source and dest. information and save it

  • Alert Button for delete record ASP

    Hello I have a delete record and have added a javascript alert box. I have 2 options. The first is OK and the second is to cancel. The problem is that I having trouble with the cancel part. It deletes the record regardless. I tried to pass informatio