Finding unique object from a collection

Hi,
Is there a way to select all the unique objects from a pool of collections?
ie, i have a set which contains (1,1, 2,3,4,4,5) and want to get (1,2,3,4,5) back? Is there a class or function that able to do that?
thx in adv

ie, i have a set which contains (1,1, 2,3,4,4,5)no you don't. sets, by definition, don't contain
duplicatesNice george. I missed the part where the OP said he had a Set.

Similar Messages

  • Find the objects from their atttachments (sood, sofm tables)

    Hello,
    I need to find the objects from the attachments.
    Ex : i have an attachement in SOOD and SOFM tables. I would like to know the perticular attachments is realted to whcih object.
    suppose, the attachement is realted to material, it doent show any maetirial details in the attachement. i need to find the relation of the attachement with the object.
    Could any one provide the sol for his.
    * * i am using 4.6c version.
    Thanks,
    khasim.

    waiting for the ans

  • How to find an object from its ID in Integration Repository

    When trying to import a package, I get an error
    "Internal error when importing object 553afdf1-c83d-11d9-871d-0007e9102256....
    I have tried to find the object using the Object->Find... menu item, but selecting Object ID in the attributes field and entering this string does not return any hits.
    Am I doing this right, or is there another way to find the object?
    Kind Regards,
    Tony.

    I am using PI7.0, If i get your question very well: I think there is no option to get an object with Id, all options are:
    Name,Changed on, Changed by,... etc.
    Pls check again.
    BR,
    Alok

  • Finding an Object from PT Spy

    Hello,
    PTSpy is displaying this info:
    Opening and querying for object with Id: 2840 and Class Id: 256
    Any idea how I find this in the db - no sql is shown, and this info keep showing over and over.
    Trying to figure out what is being queried over and over.
    Thanks,
    V

    Vivekvp wrote:
    Hello,
    PTSpy is displaying this info:
    Opening and querying for object with Id: 2840 and Class Id: 256
    Any idea how I find this in the db - no sql is shown, and this info keep showing over and over.
    Trying to figure out what is being queried over and over.
    Thanks,
    VOn your portal database you can lookup what the class ID refers to in PTCLASSDESCRIPTION.
    256 is a job I believe.
    You then need to look at the corresponding table to figure out what that ID is pointing to.
    If 256 is a job then look at the PTJOBS folder and query for one with an object ID of 2840.

  • Problems With Creating Group of Objects from a Collection

    Hi, please kindly help.
    I have a Collection. Its name is "activities". It is a collection of the Activity object with "color" as one of the attributes. I am writing a method and takes "activities" as a parameter (see below). The method is supposed to group "activities" by "color" and return a Collection called "activitiesGroups". And I have created an "activitiesGroup" (note: singular not plural) class with the getters and setters of all its attributes.
    I first sorted the "activities" by color. So far so good. Thereafter, I am iterating through this sorted list. If activity.getColor().trim() is tested different, I know that a new group, i.e., activitiesGroup, should be created and I should code activitiesGroups.add( activitiesGroup );Problems are:
    1. If I am at the first record of the sorted collection while iterating, I do not what to add a new group to the returned List activitiesGroups. I want to greate a new group only.
    Because "colorString" is initialized as a blank, when I code activitiesGroups.add( activitiesGroup );, I depend on that I am not at the first record of the sorted collection by testing if colorString.length(); is not a zero. I do not think it is the correct way to do it.
    What is the proper way of knowing I am at the first record of the sorted collection while iterating?
    2. I have to sum up two of the attributes of the ActivitiesGroup object: increaseToValue and decreaseToValue. While iterating, I repeat for each record within a group:
    aGroup.setIncreaseToValue( increase );
    aGroup.setDecreaseToValue( decrease ); How do I avoid the repetition?
         private Comparator colorComparator;
         private List activitiesGroups;
         private ActivitiesGroup aGroup;
         private String colorString = "";
         private String nextColorString = "";
         private BigDecimal increase;
         private BigDecimal decrease;               
         public List groupingByColor( List activities ) {
              if ( activities == null) {
                   return new ArrayList(0);
              if ( !activities.isEmpty() ) {
                   Collections.sort( activities, colorComparator);  // It works.
                   activitiesGroups = new ArrayList();
                   Iterator it = activities.iterator();
                   while ( it.hasNext() ) {
                        Activity activity = ( Activity )it.next();
                        nextColorString = activity.getColor().trim();                    
                        if ( !nextColorString.equalsIgnoreCase( colorString.trim() ) ) {
                             int length = colorString.length();
                             if ( length != 0 ) { activitiesGroups.add( aGroup ); } // Problem # 1
                             aGroup = new ActivitiesGroup();
                                                              aGroup.setColor( activity.getColor() );
                             increase = increase.add( activity.getIncreaseToValue() );
                             decrease = decrease.add( activity.getDecreaseToValue() );
                             aGroup.setIncreaseToValue( increase ); // Problem #2: repeated for every record in a group
                             aGroup.setDecreaseToValue( decrease ); // Problem #2: repeated for every record in a group
                        } else {
                            increase = increase.add( activity.getIncreaseToValue() );
                            decrease = decrease.add( activity.getDecreaseToValue() );
                            aGroup.setIncreaseToValue( increase ); // Problem #2: repeated for every record in a group
                            aGroup.setDecreaseToValue( decrease );      // Problem #2: repeated for every record in a group                         
                                                                    colorString = nextColorString;
              return activitiesGroups;
         }

    I first sorted the "activities" by color. So far so good. Thereafter, I am iterating through this sorted list. If activity.getColor().trim() is So in fact you are not dealing with an arbitrary Collection (as you stated in the first place), you are dealing with a List.
    You should know that there is a way to do this just with an iterator on an arbitrary collection - without needing to sort your list, and do it in O(n) time.

  • Flex/Salesforce question, updating a unique object

    Hello, I'm having some trouble updating a value for a particular unique object from an embedded swf developed using flex.
    The query works fine, and returns one record (I can see the resource in a datagrid I have in the swf), however, I see no effect of my update function. Here's the relavent snippet from my .mxml file:
    private function setResource():void{
         //get resource
         force.query("Select Total_Hours__c, Role__c, Resource__c, Rate__c, Hours_Per_Week__c From SFDC_Assignment__c WHERE Projects__r.Id = '$$$$$$' and Role__c = '$$$$$'",
              new AsyncResponder(
                   function(qr:QueryResult):void {
                        resource = qr.records.getItemAt(0);
                   }, handleFault)
         //update resource's value
         resource.Rate__c = 200;
         a1[0] = resource;
         force.update(a1, new AsyncResponder (
              function():void{
                   Alert.show("Updating...");
              }, handleFault)
    One discrepancy that I’m seeing is in the flex specific documentation, when they discuss the update function you can call on a salesforce connection: http://bit.ly/U56xx it’s a void function. However, the update function in the salesforce apex code documentation: http://bit.ly/d4Tk2 returns an array of ‘SaveResult’ object. Each element in the SaveResult array corresponds to the sObject[] array passed as the sObjects parameter in the update() call and contains information regarding the success of the update (something that would be very useful!).
    I’ve checked the sfdc database for any updates and I don’t see any for the specific operations I’m performing.
    Any one know why this isn't working? Let me know if you need any other infromation regarding our set up. Any help would be greatly appreciated. Thanks in advance.
    Relevent links:
    http://www.adnsandbox.com/media/flexsdk/docs/com/salesforce/Connection.html
    http://www.adnsandbox.com/media/flexsdk/docs/com/salesforce/Connection.html#update()

    Hello..
    I'm using the salesforce toolkit, I replicate the sample code they give to use the API, I'm having some trouble and don't find anywhere the answer, when I make a request, the server response twice, twice on login request, on other queries, sometimes I receive the response three times.
    Thanx..

  • Delete element from a collection (JDev 10.1.2)

    Hello
    I have a bean which has a collection "testCollection" and accessors for it. This has been populated with some elements (similar to the LDAPDataControls example). I have created the data control for it and dragged the collection onto a JSP as a read only form. This displays the current element of the collection depending on the iterator position.
    I then have a forward on the page using a button to a Data Action called RemoveAction. I have overwritten invokeCustomMethod and I'm trying to remove the element in the collection at the current iteraotr position.
    I can access the iterator using actionContext.getBindingContainer().findIterator("testCollectionIterator");
    From this I can get the current row but both row.remove() and row.removeFromCollection throw UnsupportedMethod exceptions.
    I can access the collection using actionBinding.getBindingContainer().getDataControl().getDataProvider(), but I have no way of removing the object from the collection without having a reference to the object itself.
    Please can someone explain how to remove elements from the collection?
    Also can someone explain in the LDAPDataControls example why its also necessary to have a class called LDAPDataControl (type of DCGenericDataControl) and a LDAPDataControlFactory (type of DataControlFactoryImpl)?
    Just having the classes LDAPSearch, the bean class LDAPEntry, and a class to hold the collection LDAPCollection works fine. Create the data control for LDAPCollection and drag the collection onto the JSP.
    Thanks.

    I'm still not sure about this. Can anyone help? Thanks.

  • "Your script uses objects from a non-existent collection"

    I have a multiple page form with a barcode on each form.  I created a separate collection for each barcode.  The auto generated code looks fine and has the correct collection created, however I still get the error, Paper Forms Barcode error "Your script uses objects from a non-existent collection".
    I'm not sure what is wrong and I don't know how to fix it.  Anyone else run into this?

    You will need to create a shared folder in Dropbox, then populate that with what ever folders you need to organize the files. It appears the DropBox app,will not handle this, but you can do, it by logging in to you account via Safari. Once the folders are created, they will show up in the app. Likewise with designating the folders as shared. Anyone you wish to share with will need a Dropbox account. (using the public folder will not work since links out it are for files only, not folders. An odd restriction, but it is what it is).
    IF you have copies of the files on a PC, you will find that will be the easiest place to upload them from. If they are only in iBooks on the iPad, you will need to synch and use the file management function to copy them off. not sure if you can synch them back over to DropCopy within iTunes (never tried it).
    DEpending on your needs, a couple of apps to look into are iCab Mobile (a browser), and GoodReader (doc viewing and management app). Both integrate well with DropBox.

  • How can I fill a table of objects from cursor with select * bulk collect???

    Hi All, I have a TYPE as OBJECT
    create or replace type dept2_o as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    I can fill a table of objects from cursor with out select * bulk collect...., row by row
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    i integer;
    begin
    i:=0;
    dept_o_tab.extend(20);
    for rec in (select * from dept) loop
    i:=i+1;
    dept_o_tab(i):=dept2_o(
    deptno => rec.deptno,
    dname => rec.dname,
    loc =>rec.loc
    end loop;
    for k IN 1..i loop
    dbms_output.put_line(dept_o_tab(k).deptno||' '||dept_o_tab(k).dname||' '||dept_o_tab(k).loc);
    end loop;
    end;
    RESULT
    10 ACCOUNTING NEW YORK
    20 RESEARCH DALLAS
    30 SALES CHICAGO
    40 OPERATIONS BOSTON
    But I can't fill a table of objects from cursor with select * bulk collect construction ...
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    begin
    dept_o_tab.extend(20);
    select * bulk collect into dept_o_tab from dept;
    end;
    RESULT
    ORA-06550: line 6, column 39;
    PL/SQL: ORA-00947: not enough values ....
    How can I fill a table of objects from cursor with select * bulk collect???

    create or replace type dept_ot as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    create table dept
    (deptno number
    ,dname varchar2(14)
    ,loc varchar2(13)
    insert into dept values (10, 'x', 'xx');
    insert into dept values (20, 'y', 'yy');
    insert into dept values (30, 'z', 'zz');
    select dept_ot (deptno, dname, loc)
      from dept
    create type dept_nt is table of dept_ot
    declare
       l_depts dept_nt;
    begin
       select dept_ot (deptno, dname, loc)
         bulk collect
         into l_depts
         from dept
       for i in l_depts.first .. l_depts.last
       loop
          dbms_output.put_line (l_depts(i).deptno);
          dbms_output.put_line (l_depts(i).dname);
          dbms_output.put_line (l_depts(i).loc);    
       end loop;
    end;
    /

  • From which version JVM starts supporting Object bindings in collections.

    from which version JVM starts supporting Object bindings in collections.
    private ArrayList<String> arr = new ArrayList();
    this will bind String objects to arr, nothing else will be stored.
    which version of JVM should I confirm, before using this feature!!!
    please comment.

    thanks MLRon!!!
    They are called "generics", not "bindings". In any case, you need Java 1.5 (also known as Java 5.0).Can generics be used anywhere, or only with collections.
    for eg:-
    public class Abc {
    public Abc(Object obj) {
    if(obj instanceOf String)
    doSomething;
    if(Obj instanceOf Xyz)
    doSomething;
    while creating Abc instance can I use this:-
    Abc<String> abc = new Abc("abc");
    and could we also do this:-
    Abc<String[]> abc = new Abc(new String[5]);
    and what exception does generics generate, if we don't obey them.
    for eg:-
    Abc<String> abc = null;
    abc=new Abc(new Xyz);
    and should generics code be kept in try catch block!!!
    please guide me!!!

  • Finding 'N'  Maximum object from a list.

    Hi,
    Collections.sort(list,comparator), will sort all the elements in the list. Whereas it is waste of resource in my case.
    I need to find only top N1 from the collection. Is there any way?
    Assume I may pass list which contains 10000 elements but I need a list which contains only top 10 elements.
    so that I can access like..
    List MaxList = Collections.sort(list, comparator, 10);
    If it is not in java, Is there any possible open source library for this.
    Regards
    Mohan

    If you don't need repeated extracts of different lenghts, then a simpler solutions that is only O(n) is possible than the ones mentioned in the other thread.
    Simply iterate over the source set, maintaining a bucket of the 10 top elements found so far. For each source element, compare its value to the lowest in the bucket, and replace it if it's greater.
    If the source set changes alot, it can make sense to maintain the bucket in parallel.
    (This approach is probably only appropriate if the bucket size doesn't vary much and the bucket size is significantly smaller than the source set.)

  • How can you move the objects from one server to another?

    how can you move the objects from one server to another?

    Hi,
    Collecting objects for Transporting
    1. rsa1->transport connection
    2. left panel choose 'object type', middle panel choose 'infocube' and 'select objects'
    3. then choose your infocube and 'transfer'
    4. will go to right panel, choose collection mode 'manual' and grouping only 'necessary objects'
    5. after objects collection finished, create request
    6. If they are $TMP, then change the package.
    7. When you click the Save on the change package, it will prompt for transport. Here you can provide an existing open transport request number, or if you like here itself you can create a new one.
    8. You can check the request in SE09 to confirm.
    Releasing Transport Request  
    Lets say you are transporting from BWD to BWQ
    Step 1: In BWD go to TCode SE10
    Step 2: Find the request and release it (Truck Icon or option can be found by right click on request #)
    Note: First release the child request and then the parent request
    Steps below are to import transport (generally done by basis )
    Step 1: In BWQ go to Tcode STMS
    Step 2: Click on Import queue button
    Step 3: Double Click on the line which says BWQ (or the system into which transport has to be imported)
    Step 4: Click on refresh button
    Step 5: High light the trasnport request and import it (using the truck icon)
    Transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/224381ad-0701-0010-dcb5-d74236082bff
    Hope this helps.
    thanks,
    JituK

  • Checks to be done before moving the objects from DEvV to PROD systems

    Hi,
         Please provide the standard methods and checks to be done in the transport requests before moving the objects from DEv to PROD.
    Please help us here.

    In se10 find your request and
    Upper left corner - Request\task -> Complete check -> Object (syntax check) and Check Request Consistency.
    This you can do for your request and all the tasks included in your request.
    Note: Transport may still fail due to numerous reason (i.e) not all the objects needed are collected in the request,
    but at atleast it gives some assurance that objects are not blocked in other requests etc...

  • Recommended practice for adding and deleting from a Collection

    Are there any suggestions for updating a Collection in a OneToMany ( privateOwned ) Collection? Here is our use case:
    1. Retrieve a Source object from the database
    2. Remove 1 or more SourceLinks from the sourceLinks Set
    3. Add 1 or more new SourceLinks to the sourceLinks Set
    4. Update the Source object
    The SourceLink object has isPrivateOwned(true).
    Adding and Removing things from a Collection seems like a fairly common use case. Are there recommended ways of handeling the above case? I've tried doing the add/remove operation in one transaction as well as removing, then re-fetching, and then adding in separate transactions and haven't had any luck.
    Here is the code an test case.
    class Source
    @OneToMany(mappedBy = "source",
    fetch = FetchType.EAGER,
    cascade = { CascadeType.ALL })
    private Set<SourceLink> sourceLinks = new HashSet<SourceLink>();
    class SourceLink
    @ManyToOne
    @JoinColumn(nullable = false)
    private Source source;
    //~ Unit Tests
    @Test
    public void testMultiUpdateSourceLink()
    // typical set up.
    SourceLink sourceLink = new SourceLink( "junit1", 48, "mp3" );
    SourceLink sourceLink2 = new SourceLink( "junit2", 64, "mp3" );
    Source mySource = new Source( "http://www.site.com", SourceType.RSS );
    mySource.addSourceLink( sourceLink );
    mySource.addSourceLink( sourceLink2 );
    beginTransaction();
    sourceDao.persist( mySource );
    commitTransaction();
    Long sourceId = mySource.getId();
    Assert.assertEquals( 2, mySource.getSourceLinks().size() );
    // fetching what we just added, then deleting something from the set
    // with privateOwned this works.
    beginTransaction();
    Source fetched = sourceDao.find( sourceId );
    fetched.deleteSourceLink( sourceLink );
    sourceDao.update( fetched );
    commitTransaction();
    Assert.assertEquals( 1, fetched.getSourceLinks().size() );
    // now fetch again, try to add a new SourceLink
    // fails with an OptimisticLockException
    beginTransaction();
    Source updated = sourceDao.find( sourceId );
    Assert.assertEquals( 1, updated.getSourceLinks().size() );
    SourceLink sl = new SourceLink( "ryan", 64, "mp3" );
    updated.addSourceLink( sl );
    sourceDao.update( updated );
    commitTransaction();
    Assert.assertEquals( 2, updated.getSourceLinks().size() );
    The sourceDao.update() method simply calls entityManager.merge(source). Is it required to flush the entityManager as well?

    Hi,
    TMG MBE doesn't have the capability to add network topolgy routes via the TMG MMC. You have to use the ROUTE ADD /P command from a privileged command prompt
    regards Marc Grote aka Jens Baier - www.it-training-grote.de - www.forefront-tmg.de - www.galileocomputing.de/3276?GPP=MarcGrote

  • Pass an ArrayList of objects from C++ to JAVA using JNI

    Hello,
    I need to get the running Windows processes using C++ and have a Process struct in C++ having 2 fields: name and pid. I want to pass an ArrayList of Process from C++ to Java. I have found an example of how to pass an array of objects from C++ to Java, but I'd like to pass an ArrayList, and I was wondering if this is possible, before understanding that example and use an array.
    I don't have much experience with C++ and I don't even know if you have something like an ArrayList in C++, so I'm sorry if it doesn't make any sense what I'm talking about. Thank you.

    From C you can access and/or imnstantiate one of the
    java collections. In other words, your C code should
    simply populate java structures and a collection.I have read this is possible after I posted this, but didn't find an example yet. I began reading "Java Native Interface" book from Addison-Wesley today to get a better understanding of JNI.
    If you know where to find an example of doing this, I would appreciate it. Otherwise, I suppose I will find this in the above mentioned book quite soon... Thank you.

Maybe you are looking for

  • UIX Master-Detail  - Find button does not display detail lines

    Hello, We have a master-detail UIX page. Master has one attribute only. When 'Next' or 'Previous' buttons are pressed, the next master-detail records are displayed. However, when master attribute's value is changed by the user and the 'Find' button i

  • VERY slow mobile Hotspot connection?

    I recently purchased the 4510L LTE mobile hotspot as it was that or dial up. I have been getting download speeds that generally cap out at about 100 KBps. That seems very slow for this area, with 3G coverage. I am always at 3 or 4 bars of service and

  • Dreamweaver error DW051 and  Media DB Error : 12

    Im using windows 8 asus laptop with slight less resolution  and trying to download adobe dreamweaver cs6 . This shows up Exit Code: 15 Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DW051 ... -----------------

  • HT1933 I purchased a car magazine and its charging me but I don't even have the magazine I purchased

    It's charging me for the magazine that I don't even have

  • Relay Server Hangs

    After every hours our DEV Relay server hangs and stops responding. There are no errors received when relay server URL is used but response takes unlimited time. http://servername.com/ias_relay_server/client/rs_client.dll To resolve this issue each ti