By comparing the dynamic fields of objects using equals and hashCode methods

To compare the different objects of the same class with their content as jobTitleId, classificationId, deptId & classificationId had to be done and do a few steps later, using Set and the map. I was able to do it by simple substitution of equals and hashCode methods of the object class and was able to read the information (as in the map below).

Map < LocationData, list < LocationData > >

The following is the class I used (its been shown you so that it can be called for my problem statement):

Class LocationData

package com.astreait.bulkloader;

public class LocationData {}

String locId, deptId, jobTitleId, classificationId;

@Override

public boolean equals (Object obj) {}

LocationData ld = (LocationData) obj;

return this.deptId.equals (ld.deptId) & & this.jobTitleId.equals (ld.jobTitleId) & & this.classificationId.equals (ld.classificationId) & &

this.locId.equals (ld.locId);

}

@Override

public int hashCode() {}

return deptId.hashCode () + jobTitleId.hashCode () + classificationId.hashCode () + locId.hashCode ();

}

}

Problem:

I am already known to which all the fields of this object, I need to make the comparison.

IE I have to use the variables named classificationId, deptId, jobTitleId & locId etc.

Need:

I need to customize this logic such as names (classificationId, deptId, jobTitleId & locId etc.) fields can be learned, dynamically, as well as their values. So, as far as I understand, I've made use of 2 classes (TableClass and ColWithData), such as the list of the ColWithData is there in the TableClass object.

I think what will happen if I substitute the same two methods "equals() and hashCode();"

as the same thing is possible.

TableClass class #1

Class TableClass {}

The list < ColWithData > cwdList;

@Override

public boolean equals (Object obj) {}

Return Boolean = false;

I need to have the logic must be set such that

all dynamic fields can be compared

return return;

}

@Override

public int hashCode() {}

Return int = 0;

I need to have the logic must be set such that

All dynamic fields for their individual codes can be found

return return;

}

}

ColWithData class #2

Class ColWithData {}

Pass the string; Here, the jobTitleId, classificationId, deptId, locId or any other information fields more may come.

String data; The corresponding data or value for each jobTitleId, classificationId, deptId, locId or any other more fields.

}

Please let me know if I'm the procedure in the right direction or should I do a different approach. If it is allowed to use the current approach then what should be done to equals and hashCode methods?

Finally, I need to make the map as: (is not worried how I give you, but may be considered my goal sought this logic)

Map < TableClass, list < TableClass > > finalMap;

I'm sorry for that. Although the problem is resolved, on my side.

Tags: Oracle Development

Similar Questions

  • Change the properties of the dynamic fields

    Hello

    I create dynamic buttons based on the configuration of the XML. I would like to dynamically change the properties of these buttons using some kind of LOOP. How can I have access to the properties of these fields created dynamically? May be using their name?

    Kind regards

    Daniel Cantin

    I map the dynamic field in an arraycollection object at creation time collection and browse the /object arraycollectoin and make the corresponding business logic.

  • When a photo has for example a bright sky beside the dark object, using lights and shadows can cause a 'halo' or double edge to appear. How can I avoid this?

    When a photo for example has a bright sky next to the dark object, using lights and shadows to reduce high contrast can cause a 'halo' or double-edge to appear. How can I avoid this?

    From my experience, this isn't a problem that has a simple solution, such as moving a slider or a combination of the sliders in LR. It requires rather a major change in the technique, at the unit or in office. Some pros (I am not one) tire ALWAYS support HDR or this reason - better transition from highlights to shadows, then tweak the image with much less "heavy" necessary. Another popular technique is the luminosity masking and blending in PS. There is a ton of information on this topic (just do a search on Youtube), but it's not easy to learn or do, but it can eliminate this problem.

  • Apple TV 4 will not play my movies that I had in itunes. It says unplayable format, but it is the same format that I use always and a lot of movies? What could this be?

    Apple TV 4 will not play my movies that I had in itunes. It says unplayable format, but it is the same format that I use always and a lot of movies? What could this be?

    This new IOS is bug.

    I had the same error message and tried to "create a different version" in Itunes.

    The ITunes says "this video is already formatted correctly."

    I tried to play again on the Apple TV and it worked then after a bit of buffering.

  • External hard drive suddenly cannot open it give the message error "you must format the disk in the drive until you can use it", and your hard disk is 0 bytes

    External hard drive can not suddenly open - fixed

    my external hard drive worked very well all the time, but suddenly I can't open it more, when I tried to open it, it gives the error message "You must format the disk in the drive until you can use it" and my hard drive is 0 bytes, average there is no file in the hard drive. Average, all the data inside hard disk are gone!

    Hello muhammad.

    Before you do anything with this player, you can search online for some data recovery utilities so that you can try to recover your data.

    What operating system do you use?

    Have you tried running chkdsk on the drive?

    Let us know.

    Best regards

    Matthew_Ha

  • validate/compare the 2 fields amount

    Hi all

    I am using oracle 10 G on windows forms.

    I need help on how to validate the amounts 2 fields.
    I compare 2 amounts fields, if the amounts are equal, then all is good. However, if the amounts are $ 5, which is very good but I would like to display a warning to the user. And if the amounts are more than $ 5, then display a different message and do not allow additional processing.

    Thanks for your help in advance,

    Hello

    Suppose you have a datablock named YOUR_BLOCK and the elements named S1 and S2.
    You need to create an alert, it's easy, go to the object navigator palette, search alerts, and then click on the button create, give to alert a name, we named our alert CFG_ASK.

    Try this in a trigger or a button, I suggest you to use when validating the trigger...

    IF :YOUR_BLOCK.S1 IS NOT NULL AND :YOUR_BLOCK.S2 IS NOT NULL THEN
    
    IF :YOUR_BLOCK.S1 <> :YOUR_BLOCK.S2 THEN
    
         IF ABS(:YOUR_BLOCK.S1 - :YOUR_BLOCK.S2) <= 5 THEN
          ALERT_CALL('CFG_ASK','ALERT','THERE IS A LITTLE DIFFERENCE');
         ELSE
              ALERT_CALL('CFG_ASK','ERROR','TOO MUCH DIFFERENCE!');
              RAISE FORM_TRIGGER_FAILURE;
         END IF;
    
    END IF;
    
    END IF;
    

    Alert_call code (program unit):

    PROCEDURE alert_call(alert_name varchar2, title_name varchar2, msg_name varchar2) IS
    
    AL_ID ALERT;
    AL_BUTTON NUMBER;
    
    BEGIN
      AL_ID := FIND_ALERT(alert_name);
      IF ID_NULL(AL_ID) THEN
           MESSAGE('There is no alert window '||alert_name); -- you must to create an alert
           RAISE FORM_TRIGGER_FAILURE;
      ELSE
           Set_Alert_Property(AL_ID, TITLE, title_name);
           Set_Alert_Property(AL_ID, ALERT_MESSAGE_TEXT, msg_name);
        AL_BUTTON := SHOW_ALERT(AL_ID);
        IF AL_BUTTON = ALERT_BUTTON1 THEN
             NULL;
        END IF;
      END IF;
    END;
    

    It will be useful.

    Points to keep in mind.

  • How to access the attributes of an object using TestStand. ?

    Hello

    I have a class named status in c# that has 2 data members. There is another class named parameter and it has functions that return objects of type status.

    I did the DLL from the parameter class. Then I added this class to NI TestStand and calls a function and this function returns an object of type status.

    Is there a way by which I can access the data members of the object returned in TestStand?

    Thanks in advance

    Yes, there is another alternative. If you state a value type (i.e. a struct in c#) then you can tell teststand to store it in a corresponding data structure TestStand rather than an object reference variable. It works even for the private fields in your structure. To do this:

    (1) first to report a type value and no matter what other changes are needed in your code to take account of this (value types are copied when it is passed by value to another method, if this isn't what you want you will have to pass by reference - i.e. the c# ref keyword).

    (2) recompile your assembly.

    (3) in the specification of module Panel TestStand .NET, you should now see a new button next to the expression for the return value of type status resembling TestStand data type icon. Press this button and it will prompt you to create a TestStand custom data type that matches the type .NET. Select this option to save the type in the type palette file MyTypes.ini. Just do it once. Once the type is in your palette file type MyTypes.ini it will be available then and you must only update if you change the type .NET.

    (4) create a local variable of the TestStand Custom data type instead of the object reference. Note that you can expand and see the properties under.

    (5) use this new local variable to store the return value of status. TestStand will be copy/update the properties of the variable to match those of the .NET structure that the method returns.

    NOTE: You can also simply store the fields of a struct in separate variables increase the return value of type status once it is a struct and specify a separate variable for each field instead of creating a custom data type TestStand.

    Don't forget that TestStand makes a copy when you store a struct that this way replaces the struct when this will not appear in the copy.

    Hope this helps,

    -Doug

  • Name of the dynamic property of object in the table based on the value of a variable

    I have two paintings of custom class objects

    var obj1:Object1
    var obj2:Object2
    
    var array1:Array = [obj1[0], obj1[1], ...]
    var array2:Array = [obj2[0], obj2[1], ...]
    

    Object1 has a property named. Name while Object2 has a property named. Title.

    Now I have a common function including cab accepts an array (array1 or array2) and the name of property the object ("Name" or "Title") as input and needs to access this name of the property of the objects in the array:

    function myFunction(arr:Array, fieldName:String)
    {
        arr[0].fieldName  = "xxx";
    }
    

    the problem I have this achievement does not because the code in the function assumes that the property of that object in the table is actually a string "fieldName" while I want to dynamically determine the names of the fields based on the value of this variable, but cannot understand the syntax to do!

    Don't know if I'm clear - hope that makes sense... ;-) Thank you

    Hey p3pp3r,

    I think I understood you. Try the following and see if you get good results:

    function myFunction(arr:Array, fieldName:String)
    {
        arr[0][fieldName]  = "xxx";
    }
    

    Let me know how it turns out. Good luck!

  • Canvas campaign: filters common vs compare the Contact fields

    HI -.

    Is there a difference between using one or several Contact fields compare elements vs using a shared filter?

    In my campaign, I need to check if one of the three fields is equal to something specific (and therefore remove them from the campaign).  I couldn't achieve exactly the same results if I used a shared filter that sought the same criteria?

    Thank you

    Abe

    1. the shared filter evaluates when someone passes through this point of decision.  It is different from that of a Segment in which a Segment is your first point of qualification for a campaign (so why someone "stays in the segment").  They actually stay in the segment so that they did not leave the campaign yet.  If the segment is more permissive, your filter shared between them, so that hardly leave the campaign according to your rule.

    2. I saw your other post on the date field.  You're right... when I try in the Web I get an error as well.  Definitely a bug in the interface user, as you can do in a segment.  I would say for now you use the shared empty contact filter and log a ticket with Support for the bug in the user interface.

  • refer to the dynamic field of tabular form in Condition of Action

    I tried to filter on this topic but didn't come with anything.

    Is there a way to refer to a field in a tabular presentation as a condition of dynamic action?

    For example, I want to make it appear a message (javascript "alert") when the value of a field in a tabular presentation is changed, but only if a certain condition meets another field in the same line.  So let's say the State field is XYZ.  So in the condition section, I PL/SQL Expression - XYZ IS NULL.  Something like that.  How I refer to this field my table form XYZ in the section on the status of a dynamic action?

    Thanks in advance.

    John

    To complete the loop and the color of things right;

    condition under when is

    $v (this.triggeringElement) = "SNSG" //or whatever, it should be

    The real action is then (note that I use the $v instead of the more modern value notation).

    var myid = $(this.triggeringElement);

    var specval = $v (myid); value of the species

    var weightval is myid.closest ('tr').find('.myweight').val ();. the weight value

    Alert (weightval);


    I hope that you should get the installer

    Kofi

  • I want to compare the 'brightness' of two images using a template image and an image acquired

    For the most part looking for suggestions on the best way to go about it. Im trying to run a test that will allow me to compare the brightness of an LCD screen using a webcam. Essentially, I let power on the screen, and from time to time, the screen will be incredibly dim. IM thinking I should be able to use the functionality of the subtraction with both images and if I have a normal screen it should produce a closure to 0 results, while the dark screen should give a non zero value (pixel wise) but have so far not been successful.

    http://zone.NI.com/reference/en-XX/help/370281AA-01/imaqvision/imaq_light_meter__point/  I used the rectangle version but this block instead of going with a subtraction! Being new on and auto teaching labview I often oversteps these easy solutions

  • It is possible to compare the contact fields based on the value of data updated?

    Hi all -

    I would like to run a filter and compare my contact fields if the value in a field has been updated or changed.

    for example if the data in the "first name" value changes to be empty to have a value, which would respect the requirement.  Also if "phone number" 123-456-7890 to 999-000-0000 that would also meet the requirement.

    Did anyone done this before?  Any ideas of how to implement?

    Any contribution is appreciated.  Thank you!

    If that's what you're talking about, there is no trace of audit in Eloqua.

    It will be great if Oracle can verify the critical fields.

    The solution is to create to the top of the field in another area, so when it changes, you can compare the values.

    Good luck

  • How to check where the table field has been used as a foreign key in the database

    Hi I have a field in my table Office I had office_code field, this field has been used in the tables of diffirent as foreign key is a sql I can wirte to see all the tables that have used this field as a foreign key

    Edited by: adf009 09/05/2013 10:37

    Edited by: adf009 09/05/2013 10:38

    Check this box

    SELECT * FROM user_constraints WHERE table_name='EMP' and CONSTRAINT_TYPE='R';
    

    Type = 'R' means referential integrity constraint type.

  • In the same field of text using several web fonts

    I know that I can do something like that when you call more weight in a web font:

    SYM. $("copier") .html ("< span style =" make-weight: 700;) "> </span > adobe | Who we are ')

    And the word Adobe will be bolder than our subject. But what about using more than one font in the same text field? I tried this:

    SYM. $("copier") .html ("< span style =" font family: "Open without", without serif;) "> </Span > UHLIG |" Who we are ')

    Now it does not work and I get a SyntaxError: missing) after the argument list

    I then tried

    SYM. $("copier") .html ("< span style =" font family: "Open without", without serif;) "> </Span > UHLIG |" Who we are ')

    and the text returned, but all that has been selected in the menu fonts was what that displayed.

    Is there a way to get around this to display two different fonts, web fonts or not, in the same field?

    Actually, I just found who. So instead of using the family of police at all, instead I did this:

    SYM. $('tête') .html ("Heading1 |") Title2');

    and then assigned a style called headEdge (or other) in an external style sheet that I used for other styles. Worked.

    As we have said before, regardless of the path we can get!

  • Compare the performance of virtual machine using RDM for physical Machine with HBA

    With the help of some great users, I recently converted a node of a cluster, MSCS running Server 2003 and SQL 2000 to a virtual machine for the cluster resulting has a physical node and a virtual node using RDM drives. See http://communities.vmware.com/thread/187822 If you're interested.

    Now my question revolves around performance. Colleagues who manage programs running on that cluster related that a backup every night a database on the thesystem take 10 minutes on a physical hardware and takes 30 minutes. A restoration took 45 minutes and now takes a little less than three hours. Is this kind of drop in performance to be expected? Is there some specific changes that I can look to improve performance.

    The virtual machine works like a single virtual machine on a machine of update3 ESX3.5. ESX server has two processors Quad-cores and 32 GB of ram, 30 GB assigned to the virtual machine.

    Any help or pointers to more information would be greatly appreciated.

    Check your card vSCSI.  If you P2V'ed, you're likely to have a Buslogic adapter.  The Buslogic adapter will limit the length of the queue 1 and limit the I/O.  Replace with the free and see if that helps you.

    Ben

Maybe you are looking for