Collection override for equals

Hi,
i have a Collection X of objects and i would like to use X.contains(blah) to check for an obect's existence. The problem is that 5 out of the six fields in the object are the same but the sixth is different.
Object o1 {
x=10;
a=1;
b=1;
c=1;
d=1;
e=1;
Object o2 {
x=20;
a=1;
b=1;
c=1;
d=1;
e=1;
These would be equal .. because the first field is irrelevant!
So, the Collection X reads {o6, o7, o8, o2} and X.contains(o1) returns true. OK? So how do i get this scenario?
Thanks.

I have a Set and I add objects of a class that has the method equals defined. Howerver the object equals method is not called when I do a contains(object). What is it that I am doing wrong?
public class TSet {
public TSet() {
Set s = new HashSet();
s.add(new MyTest("A","B"));
MyTest t = new MyTest("A","B");
// I was expecting that the equals in MyTest object
// would be called but it is not
if(s.contains(t))
System.out.println("found:" + t);
else
System.out.println("not found:" + t);
MyTest x = new MyTest("X","B");
if(s.contains(x))
System.out.println("found:" + x);
else
System.out.println("not found:" + x);
* @param args the command line arguments
public static void main(String[] args) {
new TSet();
class MyTest{
String a = null;
String b = null;
private MyTest(){}
public MyTest(String a, String b)
this.a = a;
this.b = b;
public boolean equals(Object o)
return equals((MyTest)o);
public boolean equals(MyTest t)
if(a.equals(t.a) && b.equals(t.b))
return true;
else
return false;
public String toString()
return " a=[" + a + "] b=[" + b + "]";

Similar Messages

  • Is there a report Override for AR statement print in Report One Manager?

    I have created an AR Statement in Crystal and would like to use this report in the AR Aging-->Statement(one page per customer).  I don't see an Override for A/R Statements.  Does one exist?
    Never mind.  I found it.  Collection Report.
    Edited by: Pat Frohlich on Jun 9, 2009 4:22 PM

    Hello Bill,
    You might find the report in the following location to be helpful:
    Home>Application Builder>Application XXX>Application Reports>Shared Components>Application Database Object Dependencies
    Regards,
    Arie.

  • Collection Override: how to get collections instead of arrays from UML

    Has anybody sucessfuly used the Collection Override property for Java code generation from UML using JSE8??
    I have a simple case where class A has many class B. I want to get a Collection/List of Bs from A (public Collection<B> getBs(); ) and not an array of Bs (public B[] getBs();), which I can get by creating a navigable aggregation and setting multiplicity to *.
    I think Collection Override is the correct property to use, especially based on its documentation (below), but setting a number to multiplicity is not triggering it. How should I model the association so that I'll get collections generated instead of arrays?
    ' The value of this preference indicates the name of the Java
    collection type to be used instead of generating array syntax. For
    example, if this preference is set to "ArrayList" and multiplicity is
    set on an attribute of type "int", the type of the attribute in code will
    actually be generated as "ArrayList" instead of "int[]". '
    Thanks,
    Diego

    Hi,
    Hong_Lu, this bug is still bothering us. By any chance, do you have some info when we are going to get a patch for this? I didn't find any status information about this in the bug repository.
    If this is going to take forever, would it be possible for you to give us a hint how to fix this by ourselves, temporarily? I'd rather hard-code the ArrayList/Collection as a default value rather than plain arrays like now...
    Thanks.

  • Goods Receipt Collective Slip for Mat Doc is not printing

    HI All,
    I have a strange issues. I'm trying to print collective slip for Goods Receipt which is created against of PO.
    I able to print Individual Slip when i create GR(Mat Doc) against PO with movement type 101. But I'm not able to print the Collective Slip when I create GR(Mat Doc) against PO with movement type 101. I'm saving the GR document by selecting collective slip. Error I'm getting is "The system could not create Output".
    I check the condition records in MN21, condition record is in place.
    I check in OMB5, for movement type and material document configuratio its there.
    I check in NACR, condition record is there.
    I found that In table NAST, entry for GR document created using collective slip is not available, but Individual slip GR Doc entries are there in NAST table.
    any help on this matter is highly appreciated.
    I check in SDN, Googled it, but no result.
    Thanks in Advance.

    check this
    2. Before you set up the output determination, you have to run the program RM07NCUS for each client in which you want to use the output determination function.
    This program copies the basic settings from the SAP standard client (000).
    from there:
    http://help.sap.com/saphelp_46c/helpdata/en/ed/6cec6eb435d1118b3f0060b03ca329/content.htm
    and check you have define some printer for the output.

  • HI there, I am having trouble updating my CS5 Master's Collection Suite for at least a month now. I keep gettin this message "There was an error downloading this update. Please quit now and try again later" every time and do not know how to fix it.

    I am having trouble updating my CS5 Master's Collection Suite for at least a month now. I keep getting this message "There was an error downloading this update. Please quit now and try again later" every time and do not know how to fix it.
    Any help will be highly appreciated.
    Thanks a lot in advance.
    Sincerely,
    Uvaldocj@@
    Here is a list of the products I am troubled with:
      Adobe After Effects CS5 10.0.2 Update
    There was an error downloading this update. Please quit and try again later.
      Adobe Bridge CS5 4.0.5 Update
    There was an error downloading this update. Please quit and try again later.
      Adobe Extension Manager CS5 5.0 Update
    There was an error downloading this update. Please quit and try again later.
      Adobe Illustrator CS5 15.0.2 Update
    There was an error downloading this update. Please quit and try again later.
      Adobe Pixel Bender Toolkit 2.5 Update
    There was an error downloading this update. Please quit and try again later.
      Adobe® InDesign® CS5 7.0.4 update
    There was an error downloading this update. Please quit and try again later.
      Dreamweaver CS5 11.0.4 Updater
    There was an error downloading this update. Please quit and try again later.
      Fireworks CS5 11.0.2 Update
    There was an error downloading this update. Please quit and try again later.
      Photoshop 12.0.4 update for Photoshop CS5
    There was an error downloading this update. Please quit and try again later.
      Photoshop Camera Raw 6.7 Update
    There was an error downloading this update. Please quit and try again later.

    I'm having the same issue. And Dreamweaver now crashes after just a few seconds.

  • Collective deliveries for open sales orders

    Is there any process or transaction code  for creating the collective Picking  for open sales orders.
            In my company we are not using the Warehouse management, so we pick the goods manually.
           If there is any way plzpost the answer.

    Check if VG01 helps you if you enter "K" as Group Type
    Cheers

  • Using bulk collect and for all to solve a problem

    Hi All
    I have a following problem.
    Please forgive me if its a stupid question :-) im learning.
    1: Data in a staging table xx_staging_table
    2: two Target table t1, t2 where some columns from xx_staging_table are inserted into
    Some of the columns from the staging table data are checked for valid entries and then some columns from that row will be loaded into the two target tables.
    The two target tables use different set of columns from the staging table
    When I had a thousand records there was no problem with a direct insert but it seems we will now have half a million records.
    This has slowed down the process considerably.
    My question is
    Can I use the bulk collect and for all functionality to get specific columns from a staging table, then validate the row using those columns
    and then use a bulk insert to load the data into a specific table.?
    So code would be like
    get_staging_data cursor will have all the columns i need from the staging table
    cursor get_staging_data
    is select * from xx_staging_table (about 500000) records
    Use bulk collect to load about 10000 or so records into a plsql table
    and then do a bulk insert like this
    CREATE TABLE t1 AS SELECT * FROM all_objects WHERE 1 = 2;
    CREATE OR REPLACE PROCEDURE test_proc (p_array_size IN PLS_INTEGER DEFAULT 100)
    IS
    TYPE ARRAY IS TABLE OF all_objects%ROWTYPE;
    l_data ARRAY;
    CURSOR c IS SELECT * FROM all_objects;
    BEGIN
    OPEN c;
    LOOP
    FETCH c BULK COLLECT INTO l_data LIMIT p_array_size;
    FORALL i IN 1..l_data.COUNT
    INSERT INTO t1 VALUES l_data(i);
    EXIT WHEN c%NOTFOUND;
    END LOOP;
    CLOSE c;
    END test_proc;
    In the above example t1 and the cursor have the same number of columns
    In my case the columns in the cursor loop are a small subset of the columns of table t1
    so can i use a forall to load that subset into the table t1? How does that work?
    Thanks
    J

    user7348303 wrote:
    checking if the value is valid and theres also some conditional processing rules ( such as if the value is a certain value no inserts are needed)
    which are a little more complex than I can put in a simpleWell, if the processing is too complex (and conditional) to be done in SQL, then doing that in PL/SQL is justified... but will be slower as you are now introducing an additional layer. Data now needs to travel between the SQL layer and PL/SQL layer. This is slower.
    PL/SQL is inherently serialised - and this also effects performance and scalability. PL/SQL cannot be parallelised by Oracle in an automated fashion. SQL processes can.
    To put in in simple terms. You create PL/SQL procedure Foo that processes SQL cursor and you execute that proc. Oracle cannot run multiple parallel copies of Foo. It perhaps can parallelise that SQL cursor that Foo uses - but not Foo itself.
    However, if Foo is called by the SQL engine it can run in parallel - as the SQL process calling Foo is running in parallel. So if you make Foo a pipeline table function (written in PL/SQL), and you design and code it as a thread-safe/parallel enabled function, it can be callled and used and executed in parallel, by the SQL engine.
    So moving your PL/SQL code into a parallel enabled pipeline function written in PL/SQL, and using that function via parallel SQL, can increase performance over running that same basic PL/SQL processing as a serialised process.
    This is of course assuming that the processing that needs to be done using PL/SQL code, can be designed and coded for parallel processing in this fashion.

  • Collection query for computers with windows management framework 3.0

    Hi,
    collection query for computers with windows management framework 3.0, but I cant found a way. I cant see that it is in the inventory data for SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName.
    So any way to get computers with windows management framework 3.0?
    /SaiTech

    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SoftwareProduct on SMS_G_System_SoftwareProduct.ResourceId
    = SMS_R_System.ResourceId where SMS_G_System_SoftwareProduct.ProductName like "Windows Management Framework 3.0%"
    That won't work because as mentioned, it doesn't appear in ARP.
    Torsten's suggestion will work or you can resort to software/hardware inventory using the info at
    http://serverfault.com/questions/555100/methods-to-detect-version-of-windows-management-framework
    Jason | http://blog.configmgrftw.com

  • Help,why brconnect do not collect statistics for mseg table?

    I found "MSEG" table`s statistics is too old.
    so i check logs in db13,and the schedule job do not collect statistics for "MSEG".
    Then i execute manually: brconnect -c -u system/system -f stats -t mseg  -p 4
    this command still do not collect for mseg.
    KS1DSDB1:oraprd 2> brconnect -c -u system/system -f stats -t mseg u2013f collect -p 4
    BR0801I BRCONNECT 7.00 (46)
    BR0154E Unexpected option value 'u2013f' found at position 8
    BR0154E Unexpected option value 'collect' found at position 9
    BR0806I End of BRCONNECT processing: ceenwjre.log 2010-11-12 08.41.38
    BR0280I BRCONNECT time stamp: 2010-11-12 08.41.38
    BR0804I BRCONNECT terminated with errors
    KS1DSDB1:oraprd 3> brconnect -c -u system/system -f stats -t mseg -p 4
    BR0801I BRCONNECT 7.00 (46)
    BR0805I Start of BRCONNECT processing: ceenwjse.sta 2010-11-12 08.42.04
    BR0484I BRCONNECT log file: /oracle/PRD/sapcheck/ceenwjse.sta
    BR0280I BRCONNECT time stamp: 2010-11-12 08.42.11
    BR0813I Schema owners found in database PRD: SAPPRD*, SAPPRDSHD+
    BR0280I BRCONNECT time stamp: 2010-11-12 08.42.12
    BR0807I Name of database instance: PRD
    BR0808I BRCONNECT action ID: ceenwjse
    BR0809I BRCONNECT function ID: sta
    BR0810I BRCONNECT function: stats
    BR0812I Database objects for processing: MSEG
    BR0851I Number of tables with missing statistics: 0
    BR0852I Number of tables to delete statistics: 0
    BR0854I Number of tables to collect statistics without checking: 0
    BR0855I Number of indexes with missing statistics: 0
    BR0856I Number of indexes to delete statistics: 0
    BR0857I Number of indexes to collect statistics: 0
    BR0853I Number of tables to check (and collect if needed) statistics: 1
    Owner SAPPRD: 1
    MSEG     
    BR0846I Number of threads that will be started in parallel to the main thread: 4
    BR0126I Unattended mode active - no operator confirmation required
    BR0280I BRCONNECT time stamp: 2010-11-12 08.42.16
    BR0817I Number of monitored/modified tables in schema of owner SAPPRD: 1/1
    BR0280I BRCONNECT time stamp: 2010-11-12 08.42.16
    BR0877I Checking and collecting table and index statistics...
    BR0280I BRCONNECT time stamp: 2010-11-12 08.42.16
    BR0879I Statistics checked for 1 table
    BR0878I Number of tables selected to collect statistics after check: 0
    BR0880I Statistics collected for 0/0 tables/indexes
    BR0806I End of BRCONNECT processing: ceenwjse.sta 2010-11-12 08.42.16
    BR0280I BRCONNECT time stamp: 2010-11-12 08.42.17
    BR0802I BRCONNECT completed successfully
    the log says:
    Number of tables selected to collect statistics after check: 0
    Could you give some advices?  thanks a lot.

    Hello,
    If you would like to force the creation of that stats for table MSEG you need to use the -f (force) switch.
    If you leave out the -f switch the parameter from stats_change_threshold is taken like you said correctly:
    [http://help.sap.com/saphelp_nw70ehp1/helpdata/EN/02/0ae0c6395911d5992200508b6b8b11/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/EN/02/0ae0c6395911d5992200508b6b8b11/content.htm]
    [http://help.sap.com/saphelp_nw70ehp1/helpdata/EN/cb/f1e33a5bd8e934e10000000a114084/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/EN/cb/f1e33a5bd8e934e10000000a114084/content.htm]
    You have tried to do this in your second example :
    ==> brconnect -c -u system/system -f stats -t mseg u2013f collect -p 4
    Therefore you received:
    BR0154E Unexpected option value 'u2013f' found at position 8
    BR0154E Unexpected option value 'collect' found at position 9
    This is the correct statement, however the hyphen in front of the f switch is not correct.
    Try again with the following statement (-f in stead of u2013f) you will see that it will work:
    ==> brconnect -c -u system/system -f stats -t mseg -f collect -p 4
    I hope this can help you.
    Regards.
    Wim

  • How to set collection schedule for metric thresholds

    Greetings All,
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Windows Server 2008 R2Please know that I am a newbie when in regards Enterprise Manager (any version).
    I am trying to use EM-Database Control version that was installed when I installed Oracle.
    I am trying to activate e-mail notification when tablespace(s) usage exceeds set thresholds. Specifically the locally managed tablespaces.
    I found the Metric Thresholds page, and I found the “Tablespace Space Used (%)” metric. Note this is NOT the “(dictionary managed)” metric.
    I do have e-mail and credential information established.
    I found where you can identify a SQL script to be executed for corrective actions for the warning and critical thresholds. However I don’t want to execute any corrective action, I am just interested in the e-mail notification.
    I know I could setup a SQL script that would send an e-mail but from my reading/research I believe that e-mail notification should automatically take place so long as e-mail and credential information has been established, which has been established.
    My question is:
    I can find now way to set a Collection Schedule. The dictionary managed tablespace metric has a collection schedule link (i.e. Every 15 Minutes), but the non-dictionary managed tablespace metric(s) has none.
    Clicking the edit icon(s) provides no way of setting the collection schedule.
    Where/how do I establish a Collection Schedule for this metric?
    Thanks for your time,
    Bob

    Hi Bob,
    With Grid/Cloud Control you can modify the collection frequency (interval) for the Tablespace Space Used (%) metric for locally managed tablespaces; however, you cannot do the same in DB control.
    That being said, alerts from the metric are server-generated alerts, which are generated from the monitored database target. When the space used percentage exceeds the Warning or Critical threshold, assuming you have subscribed to an appropriate notification rule for email notification, you should receive an email notification in about 1 minute or so.
    The following doc may help explain more about server -generated alerts:
    http://docs.oracle.com/cd/B28359_01/server.111/b28310/monitoring001.htm#CIHCAGAJ
    Regards,
    - Loc

  • RME 4.3.1 Inventory collection failing for cisco 3925

    Hi,
    I've a customer having LMS 3.2 and RME 4.3.1. He has 14 Cisco 3925 routers out of which inventory collection for 2 fails.
    Router IOS is: c3900-universalk9-mz.SPA.150-1.M.bin".
    Can someone suggest what might be going wrong? Attached is the  IC_Server log file for reference.
    Thanks in advance,
    inner_silence

    Hi,
    Here are the exception found from the log :-
    [ Fri Mar 18  16:28:24 EDT 2011 ],ERROR,[Thread-17],com.cisco.nm.rmeng.inventory.ics.core.CollectionController,729,Exception for device 10.103.251.12 is
    java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.cisco.nm.rmeng.inventory.ics.core.CollectionController.run(CollectionController.java:719)
        at java.lang.Thread.run(Thread.java:595)
    Caused by: com.cisco.nm.xms.xdi.ags.system.CollectionFailed: java.lang.StringIndexOutOfBoundsException: String index out of range: 2
        at com.cisco.nm.xms.xdi.pkgs.LibInventory.EnergyWise_HelperMethods.getDeviceEnergyWise(EnergyWise_HelperMethods.java:72)
        at com.cisco.nm.xms.xdi.pkgs.SharedInventoryCatIOS.EnergyWiseAGI_ENERGYWISE_Mib.g$eval(EnergyWiseAGI_ENERGYWISE_Mib.java:51)
        at com.cisco.nm.xms.xdi.ags.EnergyWiseAGI.g$eval(EnergyWiseAGI.java:21)
        at com.cisco.nm.xms.xdi.SdiEngine.initAndEvalAGIs(SdiEngine.java:383)
        at com.cisco.nm.xms.xdi.SdiEngine.request(SdiEngine.java:309)
        at com.cisco.nm.xms.xdi.SdiEngine.getDevRepr(SdiEngine.java:302)
        at com.cisco.nm.rmeng.inventory.ics.core.CollectionController.run(CollectionController.java:539)
        ... 1 more
    [ Fri Mar 18  16:28:24 EDT 2011 ],ERROR,[Thread-17],com.cisco.nm.rmeng.inventory.ics.core.CollectionController,761, Collection failed for the device : 63
    com.cisco.nm.xms.xdi.ags.system.CollectionFailed: java.lang.StringIndexOutOfBoundsException: String index out of range: 2
    Kindly check if the your device is running the required IOS on the device as per the device supported list :-
    http://www.cisco.com/en/US/docs/net_mgmt/ciscoworks_lan_management_solution/3.2/device_support/table/lms32sdt.html
    There are two 3925 listed with different versions :-
    Cisco 3925 Integrated Services Router   --> 1.3.6.1.4.1.9.1.1042  --> 15.0(1)M [RME]. if this is your device then upgrade to
    3925 to 150-1.M2
    and
    Cisco 3925E Integrated Services Router  --> 1.3.6.1.4.1.9.1.1144 --> 15.1(1)T
    Thanks,
    Gaganjeet
    If this post answers your question, please click the "Correct Answer" button

  • Collective reject for Purchase Requisition

    Hi all,
    How can I reject Purchase Requisition on ME55 without using workflow?
    Best regards,
    Munur

    Hi,
    ME55 is for collective release for PR. You can reject the PR by giving the desired code and select X button or reject in ME54. You cannot reject collectively in ME55. There is no reject button in ME55. Here we will give release code and release group and execute , the sys displays the list of PRS we can save these PRs as releaswe and select the status to need release by another code. Thanking you.
    Edited by: Padmasri Garapati on Nov 17, 2011 6:53 AM

  • Sequence of collecting objects for transport in BI

    I am making a display attribute to navigational attribute, kindly let me know the sequence of collecting objects for transport request.
    i need to check in infocube as well in multi provider.
    please let me know
    thanks,
    Venkat

    Hi,
    Make sure the Infoobjects(in which you are changing it from Display attirube to Nav attribute) and collect the other things in a seperate request (Infoproviders, the deativated transformations and the DTP followed by Queries). Release the request to QA/Prd in a sequence(Infoobject request first and the iinfoprovider request as followed by the successful movement of the first one.
    The STMS automatically take cares the sequence of trasnporting the objects one by one to the destination system.
    Regards,
    Venkat S

  • Collect Fonts for Output

    Where is the "Collect Fonts for Output" option in CS5?

    There was a demo script included with some versions that claimed to collect for output - i never tried it.
    Most of us here use either Artfiles or Scoop.  Both are 3rd party.  Scoop is a plugin, Artfiles is a separate app.

  • [svn:fx-4.x] 14929: Added missing override for maxHeight to push maxHeight down to RichEditableText .

    Revision: 14929
    Revision: 14929
    Author:   [email protected]
    Date:     2010-03-22 17:45:01 -0700 (Mon, 22 Mar 2010)
    Log Message:
    Added missing override for maxHeight to push maxHeight down to RichEditableText.  If RichEditable text is scrolling make sure to always compose with a composer so that we get consistent results.  The factory and the composer produce slightly different results which confuses the scroller.  If the component doesn't have focus there is not necessarily a composer.  It is possible that with this fix  adjustContentBoundsForScroller() is no longer needed but leave it in for now.
    QE notes:
    Doc notes: None
    Bugs: SDK-25899
    Reviewed By: Gordon
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-25899
    Modified Paths:
        flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/RichEditableText.as
        flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/supportClasses/Skinn ableTextBase.as

    Yes it is 64bit:
    [vuvffufg@HereAndNow-Main ~]$ uname -a
    Linux HereAndNow-Main 3.19.2-1-ARCH #1 SMP PREEMPT Wed Mar 18 16:21:02 CET 2015 x86_64 GNU/Linux

Maybe you are looking for