Collection issues

Hi,
Collection P has elements A,B,C,D and another Collection Q has C,D,E,F. I want a third Collection which will contain the elements A,B,E,F. i.e. the common elements of P and Q should be removed. Can you please give code for this?
Thanks
Srini

Here are two implementations you can have a look at. One is based on ArrayLists only. But because both contains() and remove() are used implicitly it gets very slow for large collections. So there's a second version based on LikedList/HashMap. It requires more temporary memory but is much faster for collections over say 5.000 members.
ArrayList differentObjects(ArrayList a1,ArrayList a2) { // LikedList/HashMap version
    LinkedList l1 = new LinkedList(a1);
    LinkedList l2 = new LinkedList(a2);
    HashSet h = new HashSet(l1);
    l1.removeAll(new HashSet(l2));
    l2.removeAll(h);
    h = null;
    l1.addAll(l2);
    return new ArrayList(l1);
ArrayList differentObjects1(ArrayList a,ArrayList b) { // ArrayList version
    ArrayList alessb = new ArrayList(a);
    alessb.removeAll(b);
    ArrayList blessa = new ArrayList(b);
    blessa.removeAll(a);
    alessb.addAll(blessa);
    return alessb;
void printArrayList(ArrayList a) {
    for (int i=0; i<a.size(); i++) {
        String s = (String) a.get(i);
        System.out.print(s);
    System.out.println();
void test() {
    ArrayList a1 = new ArrayList();
    ArrayList a2 = new ArrayList();
    a1.add(new String("A"));
    a1.add(new String("B"));
    a1.add(new String("C"));
    a1.add(new String("D"));
    a2.add(new String("C"));
    a2.add(new String("D"));
    a2.add(new String("E"));
    a2.add(new String("F"));
//    ArrayList a = differentObjects(a1,a2);
    ArrayList a = differentObjects1(a1,a2);
    printArrayList(a1);
    printArrayList(a2);
    printArrayList(a);

Similar Messages

  • Has any seen collection issues after 11g database upgrade?

    We do have an SR open.
    Just wondering if anyone else has experienced collection issues after upgrading the db to 11g? Our technical folks are hoping it is something else but for the past few weeks we have seen random issues stemming from collections. We run a full collections 5 nights a week. There are material transactions occurring during the two plus hours of collections. This seems to be randomly skewing on hand snapshots in collections as well as missing supply i.e. work orders. Only impacts a fraction of the records in material transactions and they are different every night.
    Reason I believe it has to do with transactions during collections is one collection run out of the five is generally pretty good...Sunday evening for there is very limited transactions taking place on this evening.
    Thanks in advance

    Answer to above question not required now as:
    Having read the 24th December update of note 761570.1 - 'Database Preparation Guidelines for an Oracle E-Business Suite Release 12.1.1 Upgrade' I have decided to upgrade the database to 11.2.0.x by following the Path C option.
    Unfortunately as the 11.2.0.x upgrade isn't covered by MWIZ yet I will have to follow the manual steps.

  • Performance Report Manager Data Collection Issues

    I have an agent running and collecting data in a circular file.... history.log
    Data Collection has failed approximately 6 days ago without warning. I have tried to find out the issue and have not had any success.
    If I open the Data Collection Window in PRM I see a Yellow triangle beside the hostname:port.
    If you can provide any information as to what to look for, please reply.

    history.log may be corrupted. If you run it through ccat to flatten it does it show any recent (i.e. newer than 6 days) entries?
    If ccat gives errors then just move it out of the way (i.e. rename it to history.log.busted) and restart your Agent. A fresh log will be created. Give it a couple hours to make a couple flushes of data to your SunMC Server and see if PRM works.
    Regards,
    Mike
    [email protected]

  • LMS 4.2 Topology Data Collection Issue

    Hi there,
    i have an issue with the lms 4.2 Topology Data Collection. After installation the Topology Data Collection was running normaly, but since first server reload the Topo Data Collect under Inventory > Dashboards > Device Status > Collection Summary is "frozen". It only shows the following content from first run:
    Topology Data Collection    193    0    Not Available     Running    Schedule
    Is there any option to stop this process elsewhere? I cannot find anything under jobs in running state or so. Clicking on Schedule only give me the option to start data collection, but lms always returns that the process is running.
    Thanks for help.

    Hi,
    i have reseted the ANI db using NMSROOT\bin\perl.exe NMSROOT\bin\dbRestoreOrig.pl dsn=ani dmprefix=ANI
    Everything is set to 0:
    Topology Data Collection      0 0 Not Available                          Running Schedule
    UT Major Acquisition            0 (0 End hosts 0 IP Phones) 0      Not Available Idle Schedule
    VRF Collection                    0 0                                              Not Available Idle Schedule
    But Topology Data Collection is still frozen to "Running" state....

  • LMS 3.2 Data Collection Issue

    Hi ,
    I have LMS 3.2 and license for adding 5000 devices , my data collection is running continously for the past 2 days, when i try to stop the daemon manager and restart it comes to idle state but after some time it again goes to Running state
    I am not getting the best practices deviations and discrepaqncies report after this issue
    I am attaching the ANIServer.properties , ani.log and ANIServer.log file
    Please help

    this seems to be BugID CSCtd49439:
    http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?caller=pluginredirector&method=fetchBugDetails&bugId=CSCtd49439
    also consider to install the patch for BugID CSCtg20882:
    http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?caller=pluginredirector&method=fetchBugDetails&bugId=CSCtg20882
    if you have CM 5.2 you should consider to upgrade to CM 5.2.1 which is available here:
    http://www.cisco.com/cisco/software/type.html?mdfid=282641773&flowid=5141&softwareid=280775108
    the patches for BugIDs CSCtd49439 and CSCtg20882 are availabel by contacting TAC

  • Transport collection issue

    I would like to Trasnport an infoobject from Dev to Quality.
    I have given Source system assignment correctly.
    But when I am trying to collect all related ( i mean all attributes and attributes' attribute), it is giving the following error:
    Edit objects separately since they be
    original systems
    Choose 'Display object' or 'Cancel'.
    I tried in many ways to resolve this.. But I could not collect and almost the trasnport request has failed 4-5 times. Can any one help me how to resolve this.. Its very very urgent
    Thanks
    Ananya

    Hi Ananya,
    I too had the same issue. I worked on BI7.0 SP9 .
    I could solve this by taking few infoobjects at one time rather than taking all at a time. I could find the issues exists with few infoobject like 0PLANT, 0CALMONTH etc..
    Let me explain clearly to you now.
    I Collect the cube with necessary objects in transport connection
    First I select cube and first 10 infoobjects if this is sucessful then select next ten, if you find issue with 10 select five and narrow down the selection for infoobject that is causing the issues. the same needs to be done multiple number of times to collect all the object. I tried a lot but I could not find any other solution than this .
    Hope this helps.
    Regards,
    PV

  • Debug COLLECTION ISSUES

    If have created a proto type with collections mostly to gain experience with them. What I found difficult was debugging issues.
    In the pl/sql processes I placed an htp.p statemnent to assist debuging but they don't print out. Only the success or error msg for the process prints out. How can you print out degbug messages interlaced within the pl/sql code?

    Always provide the information requested in the FAQ and forum sticky threads, especially:
    - APEX version
    - DB version and edition
    - Web server architecture (EPG, OHS or APEX listener)
    - Browser(s) used
    - Theme
    - Templates
    - Region type
    APEX provides its own debugging features (generally better than <tt>htp.p</tt>). However, these changed significantly in APEX 4.0&mdash;which is why it is necessary to know what version you are using.
    In APEX 4.0, there is an entire chapter of the documentation devoted to debugging, which is obviously a good place to start.
    With respect specifically to collections, see the sections on Reviewing Session State, as the current state of collections can be seen in the Session State viewer, and also Accessing Debugging Mode. Using the latter feature, custom debug log messages can be added to PL/SQL code using the <tt>apex_debug_message.log_*</tt> API methods, as you were seeking to do using <tt>htp.p</tt>.

  • Ciscoworks LMS 4.1 Inventory Collection issue

    We are having an issue with device inventory collection when a device or component in a device is replaced. The inventory collection job appears to be successful but the changes to devices or modules are not retreived. Short of deleting an object and adding back in, are there any configuration changes that can be made or patches that can be applied to LMS to pick up these inventory changes?

    Yes, deleting and re-adding the device works. However, changes have been made to multiple devices in the environment and aside from a bulk delete and re-add there is no guarantee that all changes to all devices will be identified and captured. the side effect will be a loss of historical data.
    Are there any options other that deleting and re-adding that will allow the application to identify the inventory changes, or is this a limitation of the product?
    Are there any items we should check to identify a potential underlying issue?

  • SMO Table collections issue

    Guys,
    I am having issues in my script when am querying the collection objects in latest SMO (SQl 2012)
    Using Microsoft.SqlServer.Smo, Version=9.0.242.0 below line returns valid table object.
    $table = $db.Tables[$tablename]  
    But using Microsoft.SqlServer.Smo, Version=11.0.0.0 the above line doesn't return anything so I am doing something like this to get table object.
    $table = $db.Tables | Where-object {$_.name -eq $tablename}. this returns the table object I am looking for.
    I have other similar issues when I am querying the collection objects.
    For ex;
    $procObject = $server.Databases[$database].StoredProcedures[$procname] (Doesn't work using latest SMO but works fine using older SMO)
    And I verified that the stored proc is in the StoredProcedures collection.
    Did this change in SQL 2012 SMO? 

    Hi YMKKrammer,
    Please check this forum, which has the similar issue with you:
    Tables[tablename] returning $NULL
    I hope this helps.

  • BULK COLLECT Issues in 10g

    I have a procedure that runs a function which uses BULK COLLECT INTO on a 9i database. When I try to run the same procedure with the same function on 10g, it fails. I can't figure out how to find the exact error message but have narrowed it down to the following:
    In the main procedure, I have this:
    Select Count(ApprId) into v_cnt
         From TABLE(udf_OverallPerms(v_camid))
         Where ApprId in
              (Select M_ApprId
                   From PM_MetricDefApproved Where M_AreaValueId=v_areaValueId and M_ParentId = 0
                   UNION
                   Select MDAC.M_ApprId
                   From PM_MetricDefApproved MDAC,
                        PM_MetricDefApproved MDAP
                   Where MDAC.M_ParentId=MDAP.M_ApprId
                        and MDAP.M_AreaValueId=v_areaValueId and MDAC.M_ParentId > 0);
    The code for the function is as follows:
    CREATE OR REPLACE FUNCTION udf_OverallPerms(v_UserCAMID IN VARCHAR2)
    RETURN OVERALL_TBL
    AS
         v_data OVERALL_TBL := OVERALL_TBL();
    BEGIN
         Select OVERALL_REC(ApprId, MAX(bRead), MAX(bWrite),
              MAX(bApprove), MAX(bDelete),
              MAX(bAdmin), MAX(bView), MAX(bViewWrite))
         BULK COLLECT INTO v_data
         From vwObjectRoles
         Where (ObjectId IN
              (Select GroupId as ObjectId from vwUsersInGroups
              Where UserCAMID=v_UserCAMID)
              AND ObjectTypeId=(Select ObjectTypeId From PM_ObjectTypes Where ObjectTypeCode='GRP'))
              OR
              (ObjectId =
              (Select UserId as ObjectId FROM PM_UserLookup
              Where UserCAMID=v_UserCAMID)
              AND ObjectTypeId=(Select ObjectTypeId From PM_ObjectTypes Where ObjectTypeCode='USER'))
         Group By ApprId;
         return v_data;
    END;
    Does anyone know of any issues in 10g with this? I have been banging my head on this for a day now.
    Thanks,
    Greg

    OK. I managed to get the EXCEPTION. Not sure it helps or not.
    ORA-02055: distributed update operation failed; rollback required
    ORA-22905: cannot access rows from a non-nested table item
    ORA-06512: at "C83_WEBDEV_PERFORM.USP_C8IMPORT_POLICY", line 179
    ORA-06512: at line 17
    Version is 10.2.0.1.

  • Mount database copy zero site collections issue

    Hi,
    I wanted to have a copy of the whole webapplication and all site collections.
    I have done a db copy and created a new webapplication where i detached the generated db in central administration.When using the PS
    Mount-SPContentDatabase WSS_Content_SP13Copy -WebApplication http://sp13:66666 -AssignNewDatabaseIdit shows me in result the Currentsitecount : 0
    And when browsing there are no site colelctions. With testdb webapplication PS it shows me orphans sites, but i need the site collections for testing.
    I already recreated again webapplication, with root site collection, with /sites collection with no collections at all, but nothing..
    How can I get the trick? Please if you have any advice, would be great! Thanks!
    gruss Daniel Ovadia MBSS - Microsoft Dynamics CRM MCNPS

    I copied the whole db not only the site collection..
    is it the same? I created a new webapplication and then assigned the DB.
    Because for my understanding it should not be an issue? Its a completly diffrent webapplication with different name and port, and the DB is also restored with a different name. Why it should be a problem if there exist in antoher webapllication with another
    port and another db name, only the site collections under this different webapp are same named, but i thought this is foreclosed??
    I am confused now...
    gruss Daniel Ovadia MBSS - Microsoft Dynamics CRM MCNPS

  • Calendar Collection Issue

    Hi All,
    I want organization specific calendar for Forecast Spreading. This is different than Manufacturing calendar.
    I want to setup this in ASCP Plan Option Forecast Spreading Calendar (12.1.3)
    I defined a new calendar and collected the data.
    This new calendar is not collected and is not available for selection in the Plan Options.
    Did anyone faced this issue and know the resolution?
    Appreciate help on this.
    Regards

    Just to update on this.
    There is no functionality to collect calendar if the calendar is not assigned as Manufacturing or Shipping.
    The workaround suggested is to define a dummy shipping method and assign new calendar to this shipping method/.
    After collections this calendar can be used in the plan option.

  • Filter quick collection issue

    Don't know if this is an issue only seen in LR 2.2 or if it's prevalent in older versions as well. I'm on 2.2 for Mac.
    I've added a bunch of images from one folder to a quick collection and working in the quick collection I've assigned star ratings to them. When I filter the quick collection using "rating = *****" I get 18 results while I have actually assigned a 5 star rating to 42 images that reside in the quick collection. When I switch back to the folder containing the images and filter it using the same "rating = *****", I get all those 42 results.
    Unless I'm doing something wrong I can not count on filtering in the quick collection. Is this the way it's supposed to work?

    Dang, Dorin, how could I have overlooked it: I had the (quiet inconspicuous) "no label" filter set to ON. Overlooked it maybe 20 times! Hadn't you stated you don't see this behaviour, I wouldn't have looked again for the 21st time.
    Thanks for replying, both of you. Problem solved + a nice link to bookmark for future reference.
    Thanks again!

  • Full garbage collection issue, not releasing/flagging memory

    I have the following problem running on a multi-cpu windows server with Java 1.4.2_05 using WebLogic 8.1:
    During a lifecyle of the web application (under load, but not to heavy) memory usage seems ok and garbage collection is called regularly. Suddenly, the used heap starts to rize very fast and after a while, even a full garbage collection cylce, does not release any memory anymore.
    I am sure that, from our coding, we release memory ok, and normally we should only use about 5 to 10 mb for each user max (with0 normal defnew garbage collections).
    I tried changing the garbage collection parameters, but this does not solve the problem. Best scenario was with the concurrent collector and I got this output at +/- the end:
    [GC 100202K->93511K(115628K), 0.0091472 secs]
    [GC 148480K->139612K(163808K), 0.0225914 secs]
    [Full GC[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor289]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor290]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor273]
    153750K->133006K(164064K), 1.2434402 secs]
    [GC 148939K->137948K(203264K), 0.0223085 secs]
    [GC 188789K->177116K(203264K), 0.0180729 secs]
    [Full GC[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor312]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor322]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor309]
    189788K->170264K(203264K), 1.1851945 secs]
    [Full GC 203228K->203227K(203264K), 1.2876122 secs]
    [Full GC 203263K->203233K(203264K), 1.3354548 secs]
    [Full GC 203263K->203258K(203264K), 1.2873518 secs]
    <Jan 17, 2007 9:40:40 AM EST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=33114655,name=console,context-path=/console)] Root cause of ServletException.
    java.lang.OutOfMemoryError
    >
    [Full GC 203263K->203233K(203264K), 1.2814516 secs]
    [Full GC 203233K->203231K(203264K), 1.6029044 secs]
    [Full GC 203263K->203242K(203264K), 1.3081352 secs]
    <Jan 17, 2007 9:41:51 AM EST> <Emergency> <WebLogicServer> <BEA-000210> <The WebLogic Server is no longer listening for connections.>
    [Full GC 203263K->203247K(203264K), 1.3161194 secs]
    [Full GC 203263K->203249K(203264K), 1.2954988 secs]
    [Full GC 203263K->203247K(203264K), 1.6423404 secs]
    <Jan 17, 2007 9:41:57 AM EST> <Alert> <WebLogicServer> <BEA-000218> <Server shutdown has been requested by <WLS Kernel>>
    [Full GC 203263K->203250K(203264K), 1.3161025 secs]
    Another strange item is: I maximized the amount of memory it uses to 512m with the Xmx parameter, I am almost sure that that one is used, but it never gets higher than 203M? Does anyone know why this is?
    Another strange item: the monitoring in the weblogic code indicates 32MB of usage (relative memory usage seems to be ok, but the quanity indication is just plain wrong) with 15 threads running.
    This problem does not exist when using JBoss 4.0.2 or 4.0.3 (standard j2ee settings).
    If anyone has an idea or can help me, I would appreciate it very very much. :)

    Hi ,
    Is this issue resolved ?
    we are facing same problem.
    1. We have checked the CPU and memory utilization everything is normal
    2. GC logs showing FULL GC calls continuously
    3. After restart the resin server system is working normally.
    Environment detail
    Resin ./resin-pro-3.0.18 on suse Linux
    Java JDK1.4.2_08
    Please suggest

  • CS6 Master collection Issue

    Hello, I bought CS6 master collection almost 2 years ago while I was doing my Undergrad at Emily Carr. Recently every time I open any of software (Photoshop, InDesign, or Illustrator) it gives me warning saying my CS6 Master Collection is a trial version and I have 5 more days left of the trial version. I bought the collection and even re-entered the serial number and it keep showing my serial number is invalid. As a freelancer I am in a very terrible situation and I think many of you can understand. If any one knows anyone with the power to fix this thing please let me know ASAP! HELP!!!

    Sign in, activation, or connection errors | CS5.5 and later
    For anything else contact activation support. Several edu licenses have been revoked recently due to fraudulent use/ abuse by the facilities issuing them
    Mylenium

  • RME Inventory never collected issue

    Hi, in my Cisco works, i am seeing many devices saying Inventory never collected, or Recently Failed devices.
    What could be the cause for Recently Failed? it means they were good before.
    and what to do with inventory never collected devices ?:(
    attached is screenshot of my licensing and versions i have. Also Error i am reffering to.

    I think this seems the same issue mentioned in this post: https://supportforums.cisco.com/message/3062089#3062089, when tied together with the other symptoms. In that case, it could be "cured" with as simply as a reboot of the server, or else TAC assistance to clean up the RME package db would be needed.

Maybe you are looking for

  • Sharing of Business Objects in Weblogic 8.1

    Hi, I am using weblogic 8.1 for my application development. It contains a Webapplication module and 2 ejb's module and each module contains about 70 Ejb's. The problem is all the modules use some common business objects. Now the business objects need

  • Filtering of ToDos in Apple Mail

    I'm impressed with the ToDo view in the new Mail 3.0. However, I can see no way of filtering the list. In particular, I am attempting to hide completed ToDo items. I've searched the menus and interrogated the Help file without success. I cannot belie

  • Is it possibe to have non numeric measures in cube??

    Hi is it possible to have non numeric measures in a cube?? As i get an error during deployment of mapping of this cube if i have non numeric measures in a cube ....

  • I want to see all my bookmarks in a column when I click the "Bookmarks" icon. icon.

    When I click the "Bookmarks" icon, my list no longer appears. They are still there but hidden. How do I get the column listing to appear again?

  • Airport Autoconnect Fixed with 10.4.6 !!!

    Title says it all folks. My MBP would not autoconnect to my wifi networks, but now with the 10.4.6 update ... fixed !!! Still whines ... still screen issues ... still runs super hot ... keyboard still needs to be replaced. 1 out of 5 ain't bad. Blue