Does Map Support User-Defined Object As Key?

Hi,
Map m = new HashMap();
m.put(myobj1, "Hello");
m.put(myobj2, "World");
I'm using my own object as the key for the map.
Since the key is a user-defined object, I would need to overload the equality operator in order to get the value.
Now, if I would to do something like this:
MyObj myObj = (MyObj)m.get(myobj3);
I found out that the equality operator for MyObj never even executes (by printing out some message). But if I would to retrieve using the original myobj1 and myobj2 object, then only the equality operator would get executed.
If I would to do the above using the String object instead of MyObj, the equality operator works fine.
I can't seemed to find a reason for the above behaviour. Any ideas?
Thanks in advance.

In a hashmap, the object is located/stored by calculating its hash code. Therefore, you need to also override the hashCode() method of the Object class so that the same objects return the same hashCode, so that you can retrieve your objects.

Similar Messages

  • Recon and provisioning of user-defined object class ICF Active Directory

    I have followed the documentation instructions for reconciliation of a user-defined object class in the ICF Active Directory connector. I am using OIM 11gR2 with the ICF Active Directory 11.1.1.5 connector patched to 11.1.1.5.0A. The procedure states to create the new object class in AD and then change the objectClass value in the Lookup.Configuration.ActiveDirectory lookup. In my case I am using the existing ObjectClass of contact, rather than a new object class. Just for completeness I am using a clone of the AD User Resource Object which I call AD User Contact and so my lookup name is Lookup.Configuration.ActiveDirCon.
    When I changed the ObjectClass from User to Contact, and ran the Active DirCon User Target Recon scheduled job, with Object Type also = contact. The first issue I noticed was that the connector wanted a different set of lookups, which is not in the documentation. It is looking for a lookup in my Configuration lookup where code key=contact Configuration Lookup (which I should have expected since there are code keys for User, Group, and organizationalUnit). I added a line to the lookup where code key=contact Configuration Lookup and the Decode=Lookup.ActiveDirCon.CM.Configuration and then I created a new lookup by that name, assigning the 5 values to be the Lookup.ActiveDirCon.UM.xxx lookups. I did not see any need to create a new set of Lookup.ActiveDirCon.CM.xxx lookups with the exact same values.
    I re-ran the scheduled job and it ran successfully, but did not generate any Recon Events, even though I had objects in the OU and I have that same OU in the Lookup.ActiveDirCon.OrganizationalUnits lookup (from the Org Lookup Recon). Everything looks good but getting no results. Looked at the log file from the ConnectorServer and it is building the query properly and executing it properly with the correct syntax, getting no errors, but the SearchAndReturnObjects method is returning zero results.
    Looking to see if anyone has successfully reconciled in user-defined or other non-User objectClass objects from Active Directory, and if so, can you provide Lookup configuration and Connector Server information so I can troubleshoot.
    I resolved this issue by changing the recon lookups to a blank lookup called Lookup.ActiveDirCon.CM.ReconAttrMap and only added in the parameters that are used by a Contact object. Only populate the ReconAttrMap with parameters that exist for the custom object.
    Edited by: Keith Smith AptecLLC on Mar 27, 2013 6:31 AM

    Oracle Support answered this question via SR

  • How can i send user defined Object as a argument to the MBean methods in authentication provider to create user?

    I developed our own Authentication, Identity Assertion & Authorization providers
    for weblogic 8.1 SP1. In the authenticator MBean i have one method which takes
    user defined object as a argument and returns a user defined object. i am able
    to call all the methods which takes java objects(for example: String, int, ArrayList,
    HashMap, Etc...) as a argument and returns also a java object but when i user
    any user defined object then it gives exception. if in the argument i used user
    defined object then it is not able to call that method telling NoSuchMethodException.
    Is there any way to use user defined object as an argument to MBean method?
    can anyone please help us as we r in the final stage of the project?
    Thanks
    Lakshmi

    "Lakshmi Padhy" <[email protected]> wrote in message
    news:3fc2f50c$[email protected]..
    >
    I developed our own Authentication, Identity Assertion & Authorizationproviders
    for weblogic 8.1 SP1. In the authenticator MBean i have one method whichtakes
    user defined object as a argument and returns a user defined object. i amable
    to call all the methods which takes java objects(for example: String, int,ArrayList,
    HashMap, Etc...) as a argument and returns also a java object but when iuser
    any user defined object then it gives exception. if in the argument i useduser
    defined object then it is not able to call that method tellingNoSuchMethodException.
    >
    Is there any way to use user defined object as an argument to MBeanmethod?
    >
    I seem to remember that jmx only supports scalar datatypes. Ask in the
    weblogic.developer.interest.management newsgroup.

  • Wanting to copy DOM element child value into user defined object in PL/SQL.

    We have a DOM object and can retrieve the object elements. We are wanting to take the elements and map them to user defined object attributes. We want to then place the element child (the text portion of <item>Foo</item> into the object attribute. Is there a package or utility that is available where we can simply pass the DOM and user defined objects and "magic happens here"?

    We have a DOM object and can retrieve the object elements. We are wanting to take the elements and map them to user defined object attributes. We want to then place the element child (the text portion of <item>Foo</item> into the object attribute. Is there a package or utility that is available where we can simply pass the DOM and user defined objects and "magic happens here"?

  • How to clone a user-defined object?

    Hello,
    I need to clone an Object[] array (propArray) that holds objects of Integer, Double, Boolean type, along with objects of user-defined ClassA, ClassB, ClassC type. The matter is that the ClassA object isn't being cloned, while the rest of the user-defined objects are cloned just fine.
    In more detail, ClassA has two properties:
    public class ClassA implements Cloneable{
       private String penaltyFor;
       private Penalty[] penaltyArray;
       protected Object clone(){
          try{
             ClassA o = (ClassA)super.clone();
             o.penaltyFor = this.penaltyFor;
    //         o.penaltyArray = (Penalty[])penaltyArray.clone();  //This ain't working.
             //But neither does this :(.
             int penCount = this.penaltyArray.length;
             o.penaltyArray = new Penalty[penCount];
             for(int i = 0; i < penCount; i++)
                o.penaltyArray[i] = (Penalty)this.penaltyArray.clone();
    return o;
    } catch(CloneNotSupportedException e){ throw new InternalError(); }
    The Penalty class contains properties of primitive type and here is its clone() method:
    public class Penalty implements Cloneable{
       private String penaltyDesc;
       private int lowLimit, upperLimit, penaltyValue;
       protected Object clone(){
          try{
             Penalty o = (Penalty)super.clone();
             o.penaltyDesc = this.penaltyDesc;
             o.lowLimit = this.lowLimit;
             o.upperLimit = this.upperLimit;
             o.penaltyValue = this.penaltyValue;
             return o;
          } catch(CloneNotSupportedException e){ throw new InternalError(); }
       }I don't know what else to try. I suppose the problem is the Penalty[] array, but I may be wrong. An alternative would be to use Copy Constructors, but it will cause too many changes to the code, since the clone() method is used for the propArray copy in many places and the ClassA object is a late addition to the propArray (unfortunately it wasn't planned to exist from the beginning).
    Thank's.

    class ClassA implements Cloneable{
       private String penaltyFor;
       private Penalty[] penaltyArray;
       public Object clone(){
          try{
             ClassA o = (ClassA) super.clone();
             if (penaltyArray!=null){
                o.penaltyArray = (Penalty[]) penaltyArray.clone();
                for(int i = 0; i < penaltyArray.length; i++) {
                    Penalty penalty = this.penaltyArray;
    if (penalty!=null)
    o.penaltyArray[i] = (Penalty) penalty.clone();
    return o;
    } catch(CloneNotSupportedException e){
    throw new InternalError();
    class Penalty implements Cloneable{
    private String penaltyDesc;
    private int lowLimit, upperLimit, penaltyValue;
    public Object clone(){
    try{
    return super.clone();
    } catch(CloneNotSupportedException e){
    throw new InternalError();
    If your Penalties are immutable, you don't need to clone them -- rather,
    make then unclonable, like Strings.

  • Dispose a user-defined object in Java

    Hello,
    Suppose I have the following loop :
    while ( some_condition) {
    UserDefinedClass abc = new UserDefinedClass();
    // do some work and exit loop.
    Everytime, I enter this loop I instantiate a new object "abc". I am worrying that if I keep doing this, after a while, I will run out
    of memory. Is there a way to dispose a user-defined object? Or is this scenario taken care of by Java garbage collection process?
    Any advice is much appreciated.
    Akino.

    Akino wrote:
    Hello,
    Thank you for your reply.
    I wonder if you could tell me how often Java does its garbage collection?That's pretty unpredictable.
    I ran a test and observed that
    my program's memory usage kept going up and up.If you gave it it 64M, and the most it ever needs at one time is 10M, it can still ramp up to the full 64M, even if it's doing frequent GC. Running GC does NOT mean that the JVM gives the memory back to the OS. It can do that, and I think it does under some circumstances, but there's no guarantee if, when, or how much it will give back. GC only means that the JVM has reclaimed space that is no longer in use by objects. Whether it holds onto that memory for future use or gives it back to the OS is up to it.

  • Using User Defined Object in B1if

    Hello Expert,
    I am trying to configure the B1if scenario for User Defined Object, But when i check the consistency of the scenario there are three issues
    1. 0142 vBIU warning - inbound - channel: defined object identifier is not listed in the repository 
    2. 0259 vBIU inconsistency - outbound - details: 'Service Method Identifier' is not correct
    3. 0262 vBIU inconsistency - outbound - details: 'Get Method Identifier' is not correct
    I have prepared the Test as a UDO in SAP B1.
    *CONFIGURATION*
    Scenario Step Definition INBOUND - CHANNEL
    Channel : INB_B1_EVNT_ASYN_EVT
    Type : SAP Business One
    Mode : Asynchronous
    Trigger : B1Event
    Object : Test
    Identification Parameter : n.a.
    Namespace Definition :  n.a.
    Retrieval
    Method  : Retrieval
    Adapter :  DI API
    Type : Service
    Rule Document  :
    id : GeneralService
    type : get
    method : getByParams
    tag : TestParams
    keys :  Code(Code)
    Outbound Phase
    Channel : OUT_B1
    Type : SAP Business One
    Format : DI Service
    Regards
    Vijay Barapatre

    Hi All,
    I have a UDO with one Table and Code and Name as fields, when I add data in SAP with the default screen I want to trigger it in B1IF, I have tried identifier 152, 153 and many more.
    But my trigger keeps returning blank so it doesn't go through to my processes.
    <?xml version="1.0" encoding="utf-8" ?>
    - <Msg xmlns="urn:com.sap.b1i.vplatform:entity" xmlns:b1il="urn:com.sap.b1i.sim:b1ilog" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" MessageId="13102816541180273503C0A80079CC46" BeginTimeStamp="20131028165411" recording="true" logmsg="0009" msglogexcl="false" MessageLog="true"> 
    - <Header> 
    <msglog step="Default message log" always="false" b1ifactive="true" />  
    - <Resumption> 
    <starter ipo="/vP.0010000119.in_BEAE/com.sap.b1i.vplatform.runtime/INB_B1_EVNT_ASYN_EVT/INB_B1_EVNT_ASYN_EVT.ipo/proc" />  
    </Resumption>
    <IPO Id="INB_B1_EVNT_ASYN_EVT" tid="13102815571480273490C0A8007961AC" />  
    <Sender Id="0010000119" />  
    </Header>
    - <Body> 
    - <Payload Role="T" Type="B1Event" add=""> 
    - <Event xmlns="" B1EventFilter="false"> 
    - <b1e:b1events xmlns:b1e="urn:com.sap.b1i.sim:b1event"> 
    - <b1e:b1event> 
    <b1e:eventsource>MobiPay</b1e:eventsource>  
    <b1e:objecttype>FC_PODO</b1e:objecttype>  
    <b1e:transactiontype>A</b1e:transactiontype>  
    <b1e:usercode>manager</b1e:usercode>  
    <b1e:userid>manager</b1e:userid>  
    - <b1e:keys count="1"> 
    - <b1e:key> 
    <b1e:name>Code</b1e:name>  
    <b1e:value>test 2</b1e:value>  
    </b1e:key>
    </b1e:keys>
    <b1e:sourcesite>BDRAPER</b1e:sourcesite>  
    <b1e:sourceport>1433</b1e:sourceport>  
    <b1e:sourcetype>6</b1e:sourcetype>  
    <b1e:sld value="BDRAPER!!MobiPay" />  
    </b1e:b1event>
    </b1e:b1events>
    - <b1ie:B1IEvent xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" SysId="0010000119" SysTypeId="B1.9.0" Task="I" LocalObjectType="FC_PODO"> 
    - <b1ie:PrimaryKeyList> 
    <b1ie:PrimaryKey Key="Code" Value="test 2" />  
    </b1ie:PrimaryKeyList>
    </b1ie:B1IEvent>
    </Event>
    </Payload>
    <Payload Role="S" />  
    </Body>
    </Msg>
    Please help,
    Regards,
    Brenden Draper.

  • Object to user defined object

    I pushed user defined objects in to the Vector or Stack.
    But they return an java defined Object type when I try to use them.
    Is there way that I can convert this Object into my defined object.
    MyClass a;
    MyClass b;
    Stack table = new Stack();
    table.push(a);
    table.push(b);
    //now when i use pop to get it back it returns an Object type
    Object temp = table.pop();
    //how do I change this object into MyClass so i can have access to MyClass stuff?

    dam..thank you so much I feel stupid..Don't.
    Casting is one of those things that can take a while to get used to.
    In your original post, you asked: how do I change this object into MyClass so i can have access to MyClass stuff?
    It's important that you understand that casting doesn't change the object in any way.
    All it does is cause a reference that's been declared as one type to be treated as a different type. So even though all the compiler knows about what's returned from pop() is that it refers to an Object, you're telling it you know better, and that the object pointed at will in fact be a MyClass, and so you can access MyClass' members.
    If, at runtime, the object you happen to pop off the stack isn't a MyClass, casting won't magically turn it into one. You'll get a ClassCastException.

  • Search Facility in User Defined Object (Default Forms)

    Hi,
    I have created a User Defined Object in the Default Forms section and chose the 'Find' tickbox when registering the UDT.  Now I have populated the data into the UDO but I can't search for data in columns.
    Am I doing something wrong please?  Can this be done?
    Thanks.

    Hi Vankri,
    Check the thread
    UDO Default form "find" function
    Regards
    Jambulingam.P

  • What is user-defined object?

    hi,
    can someone pls explain to me what does user-defined object means???
    my final yr proj is abt that and i really have no idea abt what is user-defined object...
    thank u...
    (duke point awarded of coz)

    my final yr proj is abt that and i really have no
    e no idea abt what is user-defined object...
    thank u...Well u'd better get started here (http://java.sun.com/docs/books/tutorial/getStarted/index.html) then, dont u ?
    ram.

  • Process Flow - User Defined object calling Unix Shell script not working

    Hi, I have a User Defined Object in a Process Flow with the following parameters :-
    Command: /usr/bin/ksh
    Parameter List:
    Result Code:
    Script: cd /shell_scripts
    ./dwh_get_datafile.sh param1 param2 param3
    Success Threshold: 0
    The script executes but it does not correctly interpret all the Unix commands within it e.g command such as FTP, DATE, GREP etc.
    In the job details I can see :-
    ./dwh_get_datafile.sh: date: not found
    ./dwh_get_datafile.sh: ftp: not found
    ./dwh_get_datafile.sh: grep: not found
    ./dwh_get_datafile.sh: rm: not found
    ./dwh_get_datafile.sh: ls: not found
    ./dwh_get_datafile.sh: awk: not found
    Anyone know what I have done wrong ?
    The script runs fine when run as a Unix script while logged into Telnet.
    Thanks.
    Paul

    The shell script is executed by the oracle user in the unix environment so make sure that the directorie where you can find the unix commands exists in the path for the oracle user in .profile as you can se in my example below.
    PATH=$PATH:$ORACLE_HOME/bin:$OWBHOME/bin:/ASW/ora_script:/local/bstat:/usr/bin:/opt/bin:/usr/local/bin; export PATH
    /JZ

  • Crystal Report Templates for User-Defined Objects

    Hello Experts,
    I am running SAP B1 8.8 PL11. In the current patch SAP has default Crystal Reports that can be used as Layouts for Invoices, Credit Memo's so on. Is it possbile to have layouts for user defined objects ( say for instance i have a customized form under sales module, can i import a crystal template for this customized form?). In the report layout manager i don't see an option to import user-defind objects.
    Any help would be appreciated.
    Thanks,
    Praneeth

    If this is still a problem please re-post to the SAP Integration Kit forum.

  • Manual document number in User-Defined Object

    Hi Experts,
    I have a user-defined object of document type.  I am trying to post a document using the General Service. However, I cannot assign manual document number.  There is no handwritten property available.  Is it possible to assign manual document number in user-defined objects using the DI API?
    Thanks.
    Melvin

    Hi,
    This issue has been resolved.  For the benefit of those who will be encountering this error, it was resolved by manually assigning the Handwrtten field to 'Y'.  Here is the code fragment:
    shipmentHeader.SetProperty("Handwrtten", 'Y')';

  • DTW user-defined object issues

    Dear all,
    I've tried to import a user-defined object with a template through DTW.
    However, I got an error message "To generate this document, first define the numbering series in the Administration moduleApplication-defined or object-defined error.
    Any ideas?
    Pls help.
    Thanks

    Hi,
    It is a limitation of the UDO that it is not possible to enter new values via DI or DTW. 
    There is a way to automatically fill your object's user tables. Please see the Note [804685|https://websmp130.sap-ag.de/sap(bD1odSZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=804685] for more details regarding the issue description and the workaround available.                               
    hope it helps,
    Regards,
    Ladislav
    SAP Business One Forum Team

  • UDO--user defined object

    how to use UDO--user defined object in sap b1????

    Creating UDO in SAP B1
    1. Create UDT, ( Create UDT as Document if want the code to be in auto increament form)
    2. Create UDFs for created UDT,
    3. Register Object using  "Object Registration Wizard",
                    (a) Put UDT's unique name in "UNIQUE ID" field of UDO (Image - UDO01.jpg) ,
                    (b) Do further as per requirements,
    4. After Registering the UDO, you can access it from where you have set it to access (@ UI Settings of "User - Defined Object Registration Wizard"),
    5. If you wana change the field location / change the design of the form, Open screen painter as and click on "Open User Defined Object List " (Mostly 3rd icon from Left in screen painter),
    6. Make required changes and save it by clicking "Save Form To Database" ( Mostly 2nd icon from Left in Screen Painter),
    7. Now the UDO is ready and can be used by user.

Maybe you are looking for

  • Need to add text to a field in ALV_GRID

    Hi guys, I am working on a ALV_GRID report where I have a requirement...I have one field which is for debit and credit indicator, so what I have to do is ..if field has got 'A' in it then I need to print 'Yes' in this particular filed in the output a

  • Problem in struts+displaytag+export

    when i m using displaytag (it's third party tag) with export functionality it gives below exception javax.servlet.jsp.JspException: Error - tag.getAsString : component context is not defined. Check tag syntax      org.apache.struts.taglib.tiles.GetAt

  • Help on Page

    I have created a User Guide using Framemaker.   The user guide is converted through Distiller to a pdf w/ bookmarks and Destinations. We have an Application Context properties file.   All of our users are able to go into our web application,  go to t

  • Please Help! LoadLibrary error

    Hi! Please, HELP! I was tying connect sqldeveloper 1.5.5 to Oracle 11.1.0 on vista. and got error message Io Exeption: Network adapter could not establish connection vendor code 1702 SQLplus and Enterprise Manager are working fine. Afer tracing liste

  • Summary Not correct

    Dear all expert, I had a CR which the summary field is not correct. The report is developed base on a transactional tables. I created some formula to do some simple converting such as totext and tonumber. But when I try to summarized by count or sum