Requirement for object key for HashMap

Hi,
I would like to put the object to HashMap keyed by my own object. what is the requirement for the class to be key? I have a method boolean equals(Object o) defined in the key class, My key is composed by 2 ids, so in the equals method I compared the 2 ids. but it seems can't get the value out. Please help. Thanks

How do I supposed to do the hashCode? If myKey1.equals(myKey2) returns true, then myKey1.hashCode() must return the same value as myKey2.hashCode(). One consequence of this is that if something is not used to compuate equals(), then it must not be used to compute hashCode(). (Note that the reverse is not true. That is, if two objects are not equal, they can still return the same value from hashCode(), and hence, if some data is used for equals() it may still be left out of hashCode().)
You want hashCode to be 1) quick & easy to compute and 2) "well distributed" or "mostly unique. If you know how hashcodes are used (in the general sense, not just the Java hashCode() method) then you should understand why those properties are desirable. If not, just ask.
The most common approach is to use some subset of the object's fields in computing the hashCode. If you have a Person object with lastName, firstName, birthdate, height, weight, address, phone number, you probably wouldn't use all those fields. You could just lastName, or maybe a combination of lastName and firstName.
One generally combines multiple pieces by taking XORing (the "^") operator the individual pieces (for primitives) or their hashcodes (for objects). For example, in the Person example: public int hashCode() {
    return lastName.hashCode() ^ firstName.hashCode(); // but make sure to check for null first
}

Similar Messages

  • Object key for PORDER (document links, table DRAD)

    Hi,
    the object key for PORDER entries in table DRAD looks like:
    000003054845O00000000000020000000020000
    what i know:
    character 1 to 12: ordernumber (AFKO-AUFNR)
    character 18 to 23: sequencenumber (AFVC-PLNFL)
    character 24 to 27: operationnumber (AFVC-VORNR)
    character 28 to 35: counter (AFVC-APLZL)
    so whats about character 13 to 17 and 36 to 40?
    Thanks, Martin

    Hello Martin,
    Look at the field OBJECT which indicates which is the table for which the key OBJECT Key is populated. Check the table indicated in the OBJECT field and the key for the field is the same as the value for OBJECT KEY.

  • Activate standard badi - prompts for Object Key?

    In SE19 when trying to activate an SAP delivered implementation of a badi I'm prompted for an object key for the implementation class.   
    fyi  Running ECC6 on Basis 7 kb14.
    Go to SE19
    Display badi FIAA_BW_DELTA_UPDATE
    Go to environment menu, choose activate.
    Notice that the activate option is greyed out?
    Go back and change the FIAA_BW_DELETA_UPDATE badi implementation.      Go to environment menu, choose activate. You'll be prompted for an object key for the implementing class -  CL_IM_FIAA_BW_DELTA_UPDATE.
    Is this correct behavior?   We don't want to change the class - just activate it.    Could I get around this by copying the class changing the implementation class to a ZCL_IM_FIAA_BW_DELTA_UPDATE?
    Thanks in advance for any help on this topic.

    Hi Ryan.
    You need to apply an OSS note for this
    Please check the extract below..it will solve the problem
    check the following Notes.
    Check these OSS Notes - 828240, 688477 and 590034,599896
    Note Pasted below :
    When you load the delta-enabled InfoSources of asset accounting, no time stamp information is updated in the OLTP system if you have selected "Simulation of the delta process initialization" (initialization without data transfer; technical mode 'S') as the update mode.
    This affects the InfoSources:
    1. 0ASSET_ATTR_TEXT
    2. 0ASSET_AFAB_ATTR
    3. 0FI_AA_11
    4. 0FI_AA_12
    As a result of the error, you cannot start delta extraction after the initialization without data transfer because the delta extractor does not find any time stamp information it can use.
    Other terms
    RSA3, BWOM2_TIMEST, delta, DeltaInit, BWFIT, 0FI_GL_4, BWFIT_GET_TIMESTAMPS, BWFIT_RESET_TIMESTAMPS, BWFIT_UPDATE_TIMESTAMPS
    Reason and Prerequisites
    a) The problem is caused by a program error.
    b) The 'FIAA_BW_DELTA_UPDATE' BADI is not active.
    Solution
    For a: Implement the source code corrections to create a correct time stamp for the initialization without data transfer.
    For b: For a data extraction to the BW system according to the delta method, the 'FIAA_BW_DELTA_UPDATE' BADI must be active. When assets are changed, this BADI writes the corresponding change entries which are read by the extractors to determine the delta values. If this BADI is not active, the extraction terminates with error BWFIAA 001 (BAdI implementation FIAA_BW_DELTA_UPDATE inactive in source system). During a DeltaInit extraction with data transfer, the system flags the data request as incorrect or canceled in the monitor and issues the error message. However, during the DeltaInit extraction without data transfer, the system does not issue an error in the BW system even though the extractor triggered an error message and the termination of the extraction in the OLTP system. The data request in the BW system has the status 'successful' and the user cannot see that an error has occurred. However, a time stamp is not created in these cases since the following delta extractions would cause inconsistencies because the BADI would not be able to log all changes that have occurred since the last extraction.
    Regards
    Byju

  • Object key for object type WORKITEM is not generated

    Hi experts,
    I have a problem when I create a purchase requisition by workflow. This problem happens a client copy from production to quality system has been done.
    The problem is that the object key for the object type WORKITEM is not generated. I check in transaction SWEL in quality system it displays the following data:
    For the event data I have the following data:
    Event Instance ID - 1099124
    Object Type - BUS2105
    Object key - 0120001588 (purchase requisition number)
    Event - criadaoumodificada (createdorchanged)
    For the Receiver Data I have the following data:
    Receiver Type - WS99900003 
    Object Type  (is not displayed)
    Object Key   (is empty)
    Receiver FM - SWW_WI_CREATE_VIA_EVENT_IBF
    RFC Destination - WORKFLOW_LOCAL_010
    In the Receiver Data the object type is not displayed and the object key is not generated. In production system the object type is WORKITEM, and the object key is filled by a number of workitem.
    Can anyone tell me why this happens?
    Best regards,
    Leonel

    Hi Leonel,
    as far as I remember, those fields are updated once the receiver function module was successfully processed. In your case, I'd suggest, that you ...
    - Check the workflow local RFC destination (SM59, WORKFLOW_LOCAL_<client>)
    - Check the workflow-user (SU01, User-ID WF-BATCH normally),
    - Check for entries that stuck in the event processing (tRFC queue, transaction SM58).
    - To verify the complete system, execute transaction SWU3. The section under "Runtime environment" should be marked green.  (Ignore the red sign on definition environment).
    - For a more extensive workflow runtime check, use the transaction SWUD  (workflow diagnosis).
    After all that, your problem might be solved, or at least you know, what's all okay
    Best wishes,
       Florin

  • Maintain no. range for object j_1irg23d, for 2011, excise group,

    Hi experts,
                        I m doing a depot sales process STO done, delivery done, Invoice done and excise invoice done, Now while MIGO
    the error is coming maintain no. range for object j_1irg23d, for 2011, excise group . in j1i9 i have maintained all the no. ranges for all the registers in all the plants and excise groups. Then too the error is coming. plus in MIGO the base value in excise duty tab in not been picked, i have to give manually. is that procedure correct?
    Thanks
    Prashant

    Hi all,
    I just made a silly mistake like other no. ranges i gave the serial no. of the number range as 10 or 20 which was wrong it has to be from the start i tried putting it as 01 the no. range picked up.
    Regards
    Prashant

  • Not prompted for encrytion key for /dev/mapper/home

    I never had a problem setting up encryption on my last laptop, but for some reason on this new laptop I am having the hardest time with this...
    I tried installing about four times because I thought I missed something.  I have 3 partitions /boot , / and /home, during boot / prompts me for a key and works fine, but it doesnt bother asking me for a key for /home
    In my /etc/crypttab i have
    home     /dev/mapper/home      ASK
    in my /etc/fstab i have
    /dev/mapper/home /home ext4 defaults 0 1
    during the install I did everything I thought necessary from the various archlinux wiki pages on encryption.
    am I missing something?(obviously I am)

    Here try this:
    If you using WZC or the built-in wireless utlity of windows.
    Go to network  connections > right click the wireless network connections >
    Go to the wireless network tab > delete all the prefered networks >
    Try to reconnect to the wireless network again
    If your using Linksys wireless utility or WLAN
    Open the software > Go to the profile tab and delete all that you dont need
    Try to reconnect to the network again
    The profile or the prefered networks are lists of all the networks you have ever connectec to. I believe you did not change the SSID of your network when you secured thus your computer detects it still as an unsecured network
    hope this help
    "Give them nothing... But take from them everything..."
    -Leonidas "300"

  • Looking for answer keys for "Object First with Java"

    Where can I find a book with anwser keys for the book " Object First with Java" Third Edition?

    zxcvbnm wrote:
    Where can I find a book with anwser keys for the book " Object First with Java" Third Edition?This ought to be an interesting thread. :)

  • Required solution manager key For Download SAP-IDES

    Hi All
    I need a list of items to download and install SAP Solution Manager
    Our IDES installation is not yet complete because of the required solution manager key.
    Thank you,
    Madhu Rao

    I'm not sure what you mean with "I need a list" but the installation guide is available at the usual places:
    http://service.sap.com/instguides
    --> SAP Components
    --> SAP Solution Manager
    --> Release 7.0
    Check the "Master Guide SAP Solution Manager 7.0" for an overview, which CDs/DVDs you need.
    The installation guide itself is also available on that site.
    SolMan 7.0 SR3 is not available on 32bit platforms.
    Markus

  • Object Key for PO

    Hi Guys,
    I had a requirement where i need to call a particular FM whenever a PO is getting created/changed. I had the Object Type and the event which is called when a PO is changed. How can i link the Event and the FM in R/3.So that whenever that event is called it triggers that FM Importing the Object Key.
    Thanks,
    Kittu.

    Hi Kittu,
    As far as i know we cannot link a Business Object - Event to a FM directly. We can trigger a workflow whenever a Business Object - Event occurs and in this WF we can create a Step Type: Task to which we can attach the FM.
    So whenever this event occurs the WF is triggered and you FM gets executed.
    Please let me know if further details are required.
    Regards,
    Goutham.

  • Generate DDL for objects (just for fun)

    I'm been putting together queries that generate DDL. Considering exp/imp ROWS=0 can be used, or DBMS_METADATA there is little point. Though, with restricted access those may not be possible options, but then an external tool like TOAD could do it. Therefore, my justification for this is "just for fun".
    Here is one for TABLEs. It does not generate the CONSTRAINTs (which i try to get in the next query), and no storage clauses. This query is also formatted for fixed width font with tabs equivalent to eight characters:
    SELECT
         SUBSTR
          REPLACE
          CASE
           WHEN Columns.Column_Id = 1 THEN
            'CREATE TABLE ' || Columns.Table_Name
            || CHR(10) || '('
            || CHR(10)
          END
          || ' ' || Columns.Column_Name
          || RPAD(CHR(09), Tabs - FLOOR((LENGTH(Column_Name) +1) / 8), CHR(09))
          || Data_Type
          || CASE
              WHEN Data_Type IN ('CHAR', 'VARCHAR2') THEN '(' || Char_Length || ')'
              WHEN Data_Type = 'FLOAT' THEN '(' || Data_Precision ||')'
              WHEN Data_Type = 'NUMBER' THEN
              CASE WHEN Data_Precision IS NOT NULL THEN '(' || Data_Precision
                 || CASE WHEN Data_Scale IS NOT NULL THEN ', ' || Data_Scale END
               ||')'
              END
             END
          || CASE
              WHEN Data_Default IS NOT NULL
              THEN
                RPAD
                 CHR(09),
                 CASE Data_Type
                  WHEN 'CHAR' THEN CASE Char_Length WHEN 1 THEN 2 ELSE 1 END
                  WHEN 'DATE' THEN 2
                  ELSE 1
                 END,
                 CHR(09)
               || 'DEFAULT '
               || (
                SELECT
                   ExtractValue
                    DBMS_XMLGEN.GetXMLType
                        SELECT
                             Data_Default
                        FROM
                             All_Tab_Columns
                        WHERE
                             Owner          = ''' || Columns.Owner || '''
                          AND     Table_Name     = ''' || Columns.Table_Name || '''
                          AND     Column_Name     = ''' || Columns.Column_Name ||'''
                    'ROWSET/ROW/DATA_DEFAULT'
                FROM
                   Dual
             END
          || CASE
              WHEN Columns.Column_Id = Info.Total_Columns
               THEN CHR(10) || ');' || CHR(10) || CHR(10)
              ELSE ','
             END,
             ',' || CHR(10) || CHR(10),
          ',' || CHR(10)
          1,
          181
         ) Statement
    FROM
         All_Tab_Columns     Columns,
          SELECT
              Owner,
              Table_Name,
              MAX(Column_Id)                         Total_Columns,
              MAX(FLOOR((LENGTH(Column_Name) + 1) / 8)) + 1     Tabs
          FROM
              All_Tab_Columns
          WHERE
              Owner          = 'SYS'
          GROUP BY
              Owner,
              Table_Name
         )          Info
    WHERE
         Columns.Owner          = Info.Owner
      AND     Columns.Table_Name     = Info.Table_Name
    ORDER BY
         Columns.Owner,
         Columns.Table_Name,
         Columns.Column_Id;This next query get CONSTRAINTs. No formatting is used, because it becomes quite unweildy (though, if it used multiple lines, that would change). Another interesting thing is whether the CONSTRAINT names were generated or not. If they were generated, this still uses the old name and does not generate a new one:
    WITH
         Cons_Columns
    AS
          SELECT
              Owner,
              Constraint_Name,
              SUBSTR
               REPLACE
                REPLACE
                 XMLAgg(XMLElement("A", Column_Name)
                '<A>',
                '</A>'
               4
              ) || '"' List
          FROM
               SELECT
                   Owner,
                   Constraint_Name,
                   Column_Name
               FROM
                   All_Cons_Columns
               ORDER BY
                   Position
          GROUP BY
              Owner,
              Constraint_Name
    SELECT
         'ALTER TABLE ' || Table_Name
         || ' ADD CONSTRAINT ' || Constraint_Name
         || ' '
         || CASE Constraint_Type
             WHEN 'C' THEN 'CHECK'
             WHEN 'U' THEN 'UNIQUE'
             WHEN 'P' THEN 'PRIMARY KEY'
             WHEN 'R' THEN 'FOREIGN KEY'
            END
         || '('
         || CASE
             WHEN Constraint_Type = 'C' THEN
               SELECT
                   ExtractValue
                    DBMS_XMLGEN.GetXMLType
                        SELECT
                             Search_Condition
                        FROM
                             All_Constraints
                        WHERE
                             Owner          = ''' || Cons.Owner || '''
                          AND     Constraint_Name     = ''' || Cons.Constraint_Name || '''
                    'ROWSET/ROW/SEARCH_CONDITION'
               FROM
                   Dual
            WHEN Constraint_Type IN ('P', 'R', 'U') THEN
               SELECT
                   List
               FROM
                   Cons_Columns
               WHERE
                   Cons_Columns.Owner          = Cons.Owner
                 AND     Cons_Columns.Constraint_Name     = Cons.Constraint_Name
            END     
         || ')'
         || CASE Constraint_Type
             WHEN 'R' THEN
               SELECT
                   ' REFERENCES (' || List || ')'
               FROM
                   Cons_Columns
               WHERE
                   Cons_Columns.Owner          = Cons.R_Owner
                 AND     Cons_Columns.Constraint_Name     = Cons.R_Constraint_Name
              || ' ON DELETE ' || Delete_Rule
             ELSE ''
            END
         || ' ' || DEFERRABLE || ' ' || DEFERRED
         || ' ' || VALIDATED || ' ' || STATUS || RTRIM(' ' || RELY)
         || ';'
    FROM
         All_Constraints Cons
    WHERE
         Owner = 'SYS'
    ORDER BY
         1,
         Constraint_Name;

    Shoblock, thanx!
    For NUMBER is was using a wrong COLUMN, and also in the wrong order. Serves me right for not following the documentation. And, i just ignored FLOAT. But not it mostly matches DESC (except this query shows the ", 0" where DESC drop it instead).
    I fixed the query above.
    The XML part that gets the long has a failure. If the Data_Default contains an XML special char it will get encoded. The way to not encode it, it looks, requires PL/SQL. Which means it would not be done in one query (without a FUNCTION).
    I am curious if anyone else is interested in such queries, whether for "fun" or otherwise.

  • Satellite L500 - Can't find drivers for FN keys for Windows XP!

    Hello.
    I have found and installed all drivers I need for this laptop using Windows XP. My problem is that I can only activate Wireless on this laptop by pushin FN+F8 key, I have installed the Realtek Wireless drivers and they are installed fine, but I can't get Wireless to work because of the FN keys. When I push the FN+F8 key, a blue led should turn on next to the volume controller, but it doesn't...
    I've searched for the Hotkey Utility in the Toshiba India site, I downloaded and tryed it but I get the error "This software utility does not support this system", the Common Modules gives me the same error too.
    I've tryed installing other Hotkey Utility driver for another laptop, and it doesn't give me that error, but it doesn't work either... I actually leaves my laptop freezing a second, every 5 seconds... and the FN keys still don't work.
    Anyone know where I can find a working Hotkey Utility for my laptop using XP?
    Or maybe is there a way to activate Wireless without the FN keys? I don't need the other keys... I just want a way to activate Wireless.
    Thanks for your time

    >My problem is that I can only activate Wireless on this laptop by pushin FN+F8 key, I have installed the Realtek Wireless drivers and they are installed fine, but I can't get Wireless to work because of the FN keys. When I push the FN+F8 key, a blue led should turn on next to the volume controller, but it doesn't...
    Did you try to enable the +WLan in device manager -> WLan card -> Properties -> Advanced+ tab ?
    There are some options which control the WLan card and maybe it should be possible to enable the Wlan there.

  • Need driver for Function Key for Win 7 64bit - Satellite A500-1DN

    I Finished installing Windows 7 Ultimate - 64bit
    I Want Download "Function Key" Drivers or "Function Key" Software
    I searched a lot but did not find the ... Please send it to me
    Satellite A500-1DN
    please help me...

    > Want Download "Function Key" Drivers or "Function Key" Software
    > I searched a lot but did not find the ... Please send it to me
    [VAP|http://eu.computers.toshiba-europe.com/innovation/download_driver_details.jsp?service=EU&selCategory =2&selFamily=2&selSeries=153&selProduct=852&selSho rtMod=901&language=13&selOS=30&selType=299&yearupl oad=&monthupload=&dayupload=&useDate=null&mode=all Machines&search=&action=search&macId=&country=all& selectedLanguage=13&type=299&page=1&ID=70802&OSID= 30&driverLanguage=42]
    [Flashcard support|http://eu.computers.toshiba-europe.com/innovation/download_driver_details.jsp?service=EU&selCategory =2&selFamily=2&selSeries=153&selProduct=852&selSho rtMod=901&language=13&selOS=30&selType=326&yearupl oad=&monthupload=&dayupload=&useDate=null&mode=all Machines&search=&action=search&macId=&country=all& selectedLanguage=13&type=326&page=1&ID=70816&OSID= 30&driverLanguage=42]
    Intall Vap and Flashcard support, then. I use these for my A500-1dn.

  • Can't activate the COMPARE function for object DNL_CUST_TVAST for Adapter

    Hello
    I've applier OSS note 866824 to enable the exchange of the sales area flag deletion. I had to do the initial download for the customizing object DNL_CUST_TVAST but it failed because the no intial load was permitted as the data distribution was active. So I've applied note 887696 to enable the intial load for this object : I've deleted the COMPARE function for this object with transaction R3AC3. I've done the initial load for this object and now I can't add the COMPARE function : the error message is enter linked bdoc type for synchronisation load. and I don't know what to do...
    if somebody can help me...
    thanks a lot

    Thanks for your tip but it does not work, I need to fill this field.
    I just have an answer from SAP support, this value COMPARE is relevant for loading data in CDB.
    there no sense to add the compare value for this object : the compare load can never be used for this object. It was a delivery error
    Edited by: Jerome Munier on Dec 5, 2008 7:13 PM

  • Object Key required for document in Script

    Hi All,
    I require Object Key for Document to compair with Nast-vstat. Requirement is check vstat value. How will i get object key in SAP Script.
    Regards
    Divekar Mahadev

    Objectkey(objky) you can get from NAST table. It is basically the document number.
    Regards,
    Mallick

  • SSCR Key for LV69AFZZ  User-Exit

    Hi All,
    I'm requesting for SSCR key for LV69AFZZ(sales order costing authorization control).I got SSCR Number but with this key I unable to editing the program.We are using ECC6.0.
    I requested something like this.Pls correct me If Im wrong.
    Basis release *   : 700
    Type *                : R3TR-Full Object
    Type *                : FUGR-Function Group
    Object name *        : LV69AFZZ.
    Pls advise.
    Type* : I tried with PROG also but the key is not working.
    Thank You,
    Pranitha.

    Hi,
    you can see the information you need to set for the right key, if you try to modify the programm.
    The pop-up will show you all relevant information.
    It should be
    R3TR FUGR V69A
    700
    and your installation number.
    Regards
    Nicole

Maybe you are looking for