Over riding hashtable get and put method

Hi all
Anyone have any idea about over ride HashTable get() and put(). Is it possible to over ride HashTable methods.

Yes_me wrote:
I want to change the structure of the java HashTable get and put method. As put method is having two object parameters I want to send one more parameter as String to it. Is it possible to change the structure in this way.What would you want to be returned when calling get()? I would go with the suggestion to create a class to keep that information. If you really want to, you can completely hide that information class inside your extended HashTable. You could create an overloaded put method that takes three parameters and then creates an instance of the information class and put that into the map. If you only want the data for display only, the get method could get the information class mapped to the given key, then simply return a nicely formatted String containing the two values.

Similar Messages

  • Get and Put options are greyed out in DW CS4

    I am a fairly green Dreamweaver user, and recently (finally) upgraded from MX4 to CS4.  I am trying to get a file from my local c:drive and both the get and put functions are greyed out.  Any idea how to enable these functions?  I do not have the file that I wish to transfer open.

    When you say you are trying to get a file from your local c:drive, dio you mean that you are trying to import a file into your site from elsewhere on your computer, rather than 'getting' it from your remote server.  If you are trying to import a file from your local c:drive don't use the 'get' or 'put' buttons because they are just for remote connections, instead just use windows explorer to locate the file then either copy or cut and paste the file into the folder for your site.
    Richard

  • HashSet get() and contains() methods, by value or reference?

    All the tutorials I've seen on HashSets use Strings as the object type. With Strings, it seems the get() and contains() methods work by value, not by reference.
    <CODE>
    String s1 = "dog";
    String s2 = "cat";
    String s3 = "dog";
    HashSet<String> set = new HashSet<String>();
    set.add(s1);
    System.out.println(set.contains(s1)); //true;
    System.out.println(set.contains(s2)); //false
    System.out.println(set.contains(s3)); //true
    </CODE>
    But when I use a custom object, it works by reference:
    <CODE>
    MyClass c1 = new MyClass("dog", 1);
    MyClass c2 = new MyClass("cat", 1);
    MyClass c3 = new MyClass("dog", 2);
    MyClass c4 = new MyClass("dog", 1);
    HashSet<MyClass> myClassSet = new HashSet<MyClass>();
    myClassSet.add(c1);
    System.out.println(myClassSet.contains(c1)); //true
    System.out.println(myClassSet.contains(c2)); //false
    System.out.println(myClassSet.contains(c3)); //false
    System.out.println(myClassSet.contains(c4)); //false
    </CODE>
    ("MyClass" is a simple class that holds a String and an int).
    Is there any way I can get the set to select by value rather than reference for objects that aren't String?
    If so, is it possible that the value test could be customised, so that, for example, the above will return true if the String in MyClass is the same, regardless of the int value?

    803559 wrote:
    With Strings, it seems the get() and contains() methods work by value, not by reference.
    String s1 = "dog";
    String s2 = "cat";
    String s3 = "dog";
    System.out.println(set.contains(s1)); //true;
    System.out.println(set.contains(s2)); //false
    System.out.println(set.contains(s3)); //true
    Is there any way I can get the set to select by value rather than reference for objects that aren't String?Warning: Never use the term "by reference" around Java geeks. It makes 'em go all green at the gills and they start muttering about 'bloody C++ crossovers'.
    However, as DrClap pointed out, you've mis-diagnosed the problem:
    System.out.println(s1 == s1);
    System.out.println(s1 == s2);
    System.out.println(s1 == s3));would print out the exact same results.
    For an explanation why, Google "Java String pool" or try [url http://stackoverflow.com/questions/3297867/difference-between-string-object-and-string-literal]here.
    If so, is it possible that the value test could be customised, so that, for example, the above will return true if the String in MyClass is the same, regardless of the int value?Absolutely. But, as others have said, you'd need to override equals() and hashCode().
    Winston

  • Code for replacing 'get' and 'set' method

    Hi,
    I was a struts programmer but now i am a jsf programmer :-)
    I was able to do the following with struts but no with jsf...
    The following code in struts allowed me to have no 'get' and 'set' method in the javabean for a property (for example, the property 'name'):
    ValueStack valueStack =ActionContext.getContext().getValueStack();
    valueStack.set("name", "John");
    ActionContext.getContext().setValueStack(valueStack);In the jsp, using the corresponding label to retrieve the 'name' property, returned value 'John'.
    Is there something equivalent in jsf?

    Hi, see on here.There are solutions for JSF, JBoss Seam: [Solutions for Java, JSF, JBoss Seam and Flex|http://flextrick.blogspot.com/]

  • Why do we need get and set methods?

    It is considered good design practice to keep all class data private and
    provide get and set methods for accessing the data in a controlled
    manner.
    So, instead of directly accessing the class data, you use getter and setters.
    I do not really feel the need to use get and set methods.
    How does that achieve encapsulation when ultimately the class data is being exposed?

    A couple of reasons why to use get and set:
    1. For example you can set an int value for month, if a user sets this to somting
    higher than 12 (or 11 if it's zero based) you want to handle that by either
    throwing an exception or adding a year for every time it can be devided by 12.
    If you dont do it in set you'll have a whole bunch of methods that might need to
    correct the value before retreiving the eventual date.
    2. If for some reason you have security set up for certain values you can
    implement this in the get method. When this is done somewhere else you have
    a whole bunch of methods retreiving the info in other classes that need to check
    first. (a canGet method could allso be used). Another good reason to use get
    is when the information needs to be converted depending on the consumer
    calling the get method.
    3. If any logic in 1 or 2 changes you'll have a bunch of code to change.
    If you feel there is no need to implement any security, error handling (on
    compiling because get and set might throw something) or validation when
    setting/getting these values there is still the argument of readabillity.
    Eclipse has a feature that will generate getters and setters for you so it's not
    like there is a lot of extra typing involved.
    Got interupted whyle typig so sorry to repeat any answer given before.

  • Ftp get and put grayed out

    If I want to use the FTP client JUST to get and put files in Dreamweaver without actually setting up a site how do I do that?  The put and get options are all grayed out and the client is missing the green and blue icons completely - it;s just like an ftp client that just allows you to view and do nothing else.  I am running it on Windows Server 2008 R2.  Please help!

    What Snake said.
    Why not use a standalone FTP client such as FileZilla?

  • Manager in mate becasue all method get  and not method set???

    In mate they use this technology what I do not still have clear is that because always in the managers methods go only get and not set????? Because??
    [Bindable (event="sqPhotoDBCountChanged")]
            public function get sqPhotoDBCount():uint {
                //trace("PhotoManager.sqPhotoDBCount(), 'sqPhotoDBCount' event response, sqPhotoDBCount = "+_sqPhotoDBCount);
                return _sqPhotoDBCount;
    And not this method set because????????

    In your servlet, you have written doget() method but it should be doGet().

  • How to get and put data in HTTP header in Client Side

    One JSP's function is to display data records page by page. Client users could click "First page" or "Previous Page" or "Next Page" or "Last Page" button to let the JSP to show the corresponding page. So the JSP must remember the current page number. Due to there are a number of client users maybe access the JSP at the same time, keep the current page number in session, there will be a lot of session is created at the same time, this will impact system's performance. So using session to keep data method is not used. I plan to use request header and response header to pass the current page number. I know use the response.addHeader to put data in response header and also know use request.getHeader to get data in request header in server side, but I donot know how to put data in request header and how to get data in response header in client side. Could you please give me a help? If donot use these method, are there any other method? Thanks a lot.

    Why not pass it as a parameter with the URL?
    at the beginning of the page..
    <%
    int pageNumber = Integer.parseInt(request.getParameter("page"));
    %>
    then when defining your links
    <a href="thisPage.jsp?page=<%= (pageNumber-1)%>">Previous</a>
    <a href="thisPage.jsp?page=<%= (pageNumber+1)%>">Next</a>

  • Get and Put not working in Fireworks

    The file transfer commands in Fireworks are active, since the
    sites have been defined in Dreamweaver, and they look like they
    work (the proper screens seem to pop up, but only for a second,
    even on large files), but I don't see any logs and the files are
    not actually transfered. I have to go through Dreamweavers file
    panel to transfer them. Any ideas?
    Thanks,
    Chris

    Check to make sure that PNG files aren't cloaked in DW. That
    might be
    causing the problem.
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    Extending Knowledge, Daily
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    news://forums.macromedia.com/macromedia.fireworks
    news://forums.macromedia.com/macromedia.dreamweaver
    [email protected] wrote:
    > I had to ask the system administrator about the SFTP or
    third-party systems,
    > and he said no. . . I was kind of hoping that was it.
    >
    > All the rest of what you mentioned had been done. The
    file transfer buttons
    > were and are active. If I do a transfer in Dreamweaver,
    it works just fine. But
    > when I open the same file in fireworks, then try a Put,
    the file transfer
    > screens just fly by, and no file is transfered.
    >
    > I was able to trap a screen. One says "Failed to delete
    file
    > product_template_NNW2.png.LCK" - this seems to happen
    when I create a file
    > locally and there isn't a corresponding file already
    existing on the remote
    > server.
    >
    > When the file does exist on the remote server, I get the
    message
    > '"product_template_3.png" is newer on the remote server.
    Do you wish to
    > overwrite it?' - but when I press Yes, again the dialog
    box pops up very
    > quickly and dissapears, and again, no file is actually
    transfered.
    >
    > Should I open a Tech Case with Adobe?
    >
    >
    >

  • Statistical distributions - get and setter methods

    Hi,
    I found the Weibull and Cauchy class here:
    http://commons.apache.org/math/api-1.1/org/apache/commons/math/distribution/CauchyDistributionImpl.html
    however these distributions do not seem to have methods to pick a random number within the distribution.
    Does anyone have any advise on how to do that?
    Thanks,
    Lene

    Ok, I don't see a getNextValue or getNextDouble.
    Did you mean inverseCumulativeProbability?
    I guess I could create a random P and then look up the x at that p, to get a random value from the distribution.
    Thanks,
    Lene

  • Usage of AQ$_JMS_MESSAGE getter and setter methods in PL/SQL functions

    Hi all,
    while setting up a transformation from a AQ$_JMS_TEXT_MESSAGE to a user-defined type "msgtype" ( subject varchar2, text clob ) I tried to use the get_text() method within the transformation function but got a
    ORA-25229: error on transformation of message msgid: ...
    ORA-30625: method dispatch on NULL SELF argument is disallowedAccessing the CLOB part of the jms_text_message directly did not work. But within an anonymous PL/SQL procedure, get_text() works fine.
    It has to be in a function to work as a transformation, but how can I do this?
    Here's my current code:
    CREATE OR REPLACE FUNCTION jms2msg_t(in_jms SYS.AQ$_JMS_TEXT_MESSAGE)
    RETURN TxtMsgType AS
      new_msg  TxtMsgType;
      v_oldmsg SYS.AQ$_JMS_TEXT_MESSAGE;
      v_clob   CLOB := EMPTY_CLOB;
    BEGIN
      dbms_lob.createTemporary( v_clob, true );
      dbms_lob.open( v_clob, DBMS_LOB.LOB_READWRITE );
      v_oldmsg.get_text( v_clob ); -- ora-30625 happens here ----------------
      new_msg := TxtMsgType( dbms_lob.substr( in_jms.text_lob, 10 ), v_clob );
      dbms_lob.freetemporary(lob_loc => v_clob);
      RETURN new_msg;
    END jms2msg_t;
    /MetaLink, Oracle Docs and Google didn't help me. I know of the countermeasures against ORA-30625 in user defined types, but I cannot change JMS-Types, So, what could I do?
    Regards,
    Uwe

    Gee, this was a no-brainer. Thanks to cut w/o paste, I lost the initializing line:
    v_oldmsg:=in_jms;The uninitialized JMS object then throws this kind of "null pointer exception".
    Well, at least I got to know a new ORA-code. ;-)

  • What is get and set methods of class

    I m new for OOP concept see this is my class, How this class will return values???
    package poker
        import com.smartfoxserver.v2.protocol.serialization.SerializableSFSType;
        public class SeatInfo implements SerializableSFSType
            private var _seats:Array;
            private var _buyInLow:int;
            private var _buyInHigh:int;
            public function SeatInfo(){
            public function get seats():Array{
                return _seats;
            public function set seats(seats:Array):void{
                this._seats = seats;           
            public function get buyInLow():int
                return _buyInLow;
            public function set buyInLow(buyInLow:int):void
                this._buyInLow = buyInLow;
            public function get buyInHigh():int
                return _buyInHigh;
            public function set buyInHigh(buyInHigh:int):void
                this._buyInHigh = buyInHigh;
            public function toString():String
                var str:String="seatinfo";
                str += "amtlow" + ": " + _buyInLow + "amthig" + ": " + _buyInHigh + " :\n";
                if (_seats != null)
                    for each (var seat:Seat in _seats)                
                    str += "seat :" + seat.seatId +"\n"   
                return str;

    package poker
        import com.smartfoxserver.v2.protocol.serialization.SerializableSFSType;
        public class SeatInfo implements SerializableSFSType
            private var _seats:Array;
            private var _buyInLow:int;
            private var _buyInHigh:int;
            public function SeatInfo(){
            // this returns _seats
            public function get seats():Array{
                return _seats;
            public function set seats(seats:Array):void{
                this._seats = seats;           
    // this returns _buyinLow
            public function get buyInLow():int
                return _buyInLow;
            public function set buyInLow(buyInLow:int):void
                this._buyInLow = buyInLow;
            // this returns _buyInHight
            public function get buyInHigh():int
                return _buyInHigh;
            public function set buyInHigh(buyInHigh:int):void
                this._buyInHigh = buyInHigh;
            public function toString():String
                var str:String="seatinfo";
                str += "amtlow" + ": " + _buyInLow + "amthig" + ": " + _buyInHigh + " :\n";
                if (_seats != null)
                    for each (var seat:Seat in _seats)                
                    str += "seat :" + seat.seatId +"\n"   
                return str;
    so, in another class where you need those variable values:
    import SeatInfo;
    var seatInfo:SeatInfo;
    var seatsVar:Array;
    var buyInLowVar:int;
    var buyInHighVar:int;
    seatInfo = new SeatInfo();
    seatsVar = seatInfo.seats;
    buyInLowVar = seatInfo.buyInLow;
    buyInHighVar = seatInfo.buyInHigh;

  • Generic Getter and Setters

    Hi all,
    I want to dynamically access getter and setter methods depending on the variables i have
    suppose i have a variable
    String checkGetter;
    and a getter method
    public String getCheckGetter(){return this.checkGetter;}
    and in addition to that some more variables and their getters and setters
    and i want to access all the getter/setter methods dynamically ,if i am having only the variable name(as a String). I dont want to add code for accessing these methods, instead put in a loop and do my work.
    Can one achieve this in Java.
    Thanks in advance.
    Regards.

    neo_java wrote:
    I am just trying to understand if there is any way to assign values to variables where the value to be assigned to the variable depends on run time
    (here the variable is important to me which changes dynamically).Rene's first Law of Anti-Static: every idea including the word "dynamically" can be safely disregarded as foolish.
    You can not assign anything to variables by names. You can assign values to instance or class attributes using Reflection. You can also drive a car backwards all the time. It's awkward, it won't work nicely and it can crash quite quickly. You could also use a map where you store a value assigned to a certain key or name, as already mentioned. Or you could pass the name (why do you have the name in the first place!? No good.) along with the value to the instance and let the instance find out what to do by itself.

  • Db services find and put them back after node is up

    version 10203
    We have 3 node RAC, if one node goes down how i can find out what services failed over to remaining nodes and put them back after take 3rd node up? any metalink notes# would help too , just to clear my concepts.

    Hello,
    Take a look on gv$services dictionary view
    Use the srvctl relocate service command with the following syntax:
    srvctl relocate service -d db_unique_name -s service_name -i old_inst_name -t new_inst_name [-f]
    srvctl relocate service -d crm -s crm -i crm1 -t crm3
    See it on http://download.oracle.com/docs/cd/B19306_01/rac.102/b14197/srvctladmin.htm#RACAD5051
    Cheers,
    Rodrigo Mufalani
    http://mufalani.blogspot.com

  • I made 2 playlists on Itunes and put them on my Ipod.  How do I get the songs to play consecutively and not keep playing the same song over and over again???

    I'm a new Zumba instructor and have to come up with playlists for my routines.  I made 2 playlists on ITunes and put them on my Ipod.  Everytime I want to play it, only one song from the list plays over and over.  The other songs do not.  How do I get the songs to play the way I have them set up??

    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    For other music you need to get them from where you got them before.

Maybe you are looking for