Check the object of whose instance it is in an HashSet

Hi guys,
I have 2 subclasses.
I am adding instances of those classes in one HashSet.
But afterall i need to check how many instance found in this HashSet.
I tried to return data in an HashSet again. However returned HashSet has no element.
Student class inherited from Person class
--public static void main(String [] args){
          HashSet mySet = new HashSet();
          HashSet resultSet = new HashSet();
          Student s = new Student("Student1","1",new Date(12-12-2007));
          Teacher t = new Teacher("Teacher1","2",1.1);
          Teacher t1 = new Teacher("Teacher2","2",1.1);
          mySet.add(s);
          mySet.add(t);
          mySet.add(t1);
          resultSet = s.displayStudent(mySet); //here it stucks
public HashSet displayStudent(HashSet mySet){
          Iterator it = mySet.iterator();
          HashSet innerSet= new HashSet();
          innerSet = null;
          while (it.hasNext()) {
               if (it instanceof Student)  {
                    //System.out.println(getName());
                    //System.out.println(getAddress());
                    //System.out.println(getEntryDate());
                    innerSet.add(it);
                                it.next();
               else it.next();
          return innerSet;
     }

"it" is an Iterator and will never be instanceof Student. But the object returned by "it.next()" might be.

Similar Messages

  • Lumira Login Error "Check the Server Name and Instance ID"

    Dear Experts
      I installed Lumira Desktop and was able to connect to the
    HANA Server.
    Later while I was working the software hanged and I had to
    shut it down.
        Now, after re-opening the software I receive error "Check the Server Name and Instance ID"
    (though the server credentials are same as error and correct”
    Any suggests on how to rectify

    I wonder if one of the following KBAs may give you a clue?
    1995325 - Error HDB 11009: The dataset could not be published to SAP Lumira Server because publishing to the SAP HANA layer failed. Lumira Server
    2134259 - Lumira LaunchPad Logon Hangs
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow me on Twitter (#SAPLumira)
    Got Enhancement ideas? Use the SAP Idea Place 

  • Can we check the Objects modifiable " option for standard objects

    Dear Friends
                 In IR , we have imported SRM SERVER->SRM SERVER5.5
    Then we  have checked the option<u><b> "Objects are modifiable"</b></u> then we imported the IDOC from R/3 system under SRM SERVER 5.5 swcv.
    Then created the mapping.It is working fime.
    how ever i am not sure whether it is right process.Can we check the "Objects are modifiable" for standard compoents delivered by SAP????
    Regards
    chandra

    Hi Jai,
      <i> >>>Can we check the "Objects are modifiable" for standard compoents delivered by SAP????
    No. As best practise you are not supposed to do so.</i>
    In order to implement any changes in the mapping we can do it rite.
    Because recently i have applied one SAP note to my SRM swcv and one of the MM object was changed according to the requirements.
    Thanks,
    Prasanthi.

  • Regarding checking the objects versions after transporting

    Hi
    we are doing transportation from DEV to  QAS. what we have done is
    we have collected all master data objects,data sorses,transformations,dtps,process chains into different transport recquests and releases the recquests ,and imported recq in QAS.
    now our recq is to check whether all master data objects,data sorses,transformations,dtps,process chains are transported or not
    if transported have to check all obj are in active version or not.
    at present we are follwing below procedure
    a) go to se09 in DEV and select 1 recq and check the objects list under that recq then copy one obj and check in QAS,the same procedure for all objects, but we are having 100 recquests, under each recq we are having many objects.
    if we follow that it wil take days,so is there any procedure to check
    are there any tables where we can check fast and minimise the time.

    am not sure about the object status however can get list of objects in your transports from below process :
    Go to table E071 and give your request numbers as input. It will give you list of all the objects contained in those requests.
    Now object will be of different types , IOBJ - Infoobjects , ODSO - ODS , MPRO - Multiprovider , TRFN - Transformation etc.

  • How can I check an object is an instance of any type within an array of related types?

    In LabVIEW, it's possible to check the runtime type of an object using To More Specific Class.vi. One usage of this would be to perform a safety check if some kind of class uses instances of another kind of class but is only able to handle a subset of that class' child types.
    For instance, let's say you had Beverage.lvclass, which represents an abstract type of product, and several subclasses: Coffee.lvclass, Tea.lvclass and Soda.lvclass.
    We also have a Person.lvclass which can drink beverages. A person also has preferences about the drinks they do or do not like:
    Attached is an implementation of this in LabVIEW.
    In Person.lvclass : Drink.vi, I have the following code. For whatever reason the wire appears broken in these snippets but it's all fine in the actual code.
    In Scenario.vi, I have the following code:
    What I'm finding is that no error is generated and instead I get "Yum, I love tea!", "Yum, I love coffee!" and "Yum, I love soda!". My guess is that To More Specific Class.vi casts to the static type of the "target class" input wire rather than its runtime type - and because I'm passing in elements from an array of types, the wire's static type is upcasted to the most specific type that is a superclass of the types in the array - which would be Beverage.lvclass. And so the cast is trying to determine if an object of static type Beverage.lvclass is an instance of Beverage.lvclass, which will of course be the case all the time.
    Is there any way to make LabVIEW check against the most specific runtype type of an object? As in, is there something I could do that, in this example case, would allow me to get the required behaviour of Joe throwing an error when he's made to drink soda? Or is this another limitation of LabVIEW that I'm going to have to live with?
    Solved!
    Go to Solution.
    Attachments:
    TypeCastingExample.zip ‏64 KB

    tst wrote:
    Your guess seems reasonable. I can't check right now, but there's a primitive called preserve run time type, which should do what you want.
    Cheers, that seems to have got it! I've never really looked at Preserve Run-Time Class before, but it seems to do the right thing.

  • [Help] How to check the object locks held by a specific thread?

    As the title I want to check locks held by a specific thread. How can I do this? In Java lock is acquired and release automatically by stating synchronized keyword. I have no idea on how to check the lock status and who owns whick lock.
    Regards,
    Skeeter

    Look for the method:
        public static native boolean holdsLock(java.lang.Object);Its in the java.lang.Thread class. It will check the lock status for an object for the calling thread.

  • How to check the objects size in DBA_RECYCLEBIN

    Hi All,
    I want to purge dba_recyclebin, before that i want to check the size of all objects residing in dba_recyclebin.
    I am using below query to goup by tablespace.
    SELECT TS_NAME, SUM(SPACE*1024)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc
    Kindly inform me is the correct way to check it. for example if the 10gb space is shown from this query, will i able to see 10GB free space after purging. Kindly confirm
    Thanks
    Krishna

    I am using below query to goup by tablespace.
    SELECT TS_NAME, SUM(SPACE*1024)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc
    As I mentioned, the SPACE field is in terms of BLOCKS rather than bytes.
    First confirm your database block size using
    SQL> show parameter db_block_size
    then modify the query as
    SQL> SELECT TS_NAME, SUM(SPACE*<DB_BLOCK_SIZE>)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc;
    I am quite sure the db_block_size in your database is 8192.
    Since you have used 1024 instead 8192 as the block size, you are seeing the difference in DBA_RECYCLEBIN and DBA_SEGMENTS

  • How to Checked The Object Not Locked by Others in Transport

    Hi all,
    I have problem in transporting workbook to production, the question is:
    a. How to Solve Object that is locked by other transport requests
    b. How to Check Object Not Locked by Others Request before doing transport.
    Thanks in advance
    supriatna

    Hi Supriatna,
    In the same screen where you have been 'Search for Objects in Requests/Tasks' place your cursor in one of the empty fields (the second column, eg. PROG) and look up for XLWB. You have increase the number of displayed entries in the look up screen to atleast 1000 to find the R3TR XLWB entry (Excel workbook entry).
    Hope this helps.
    Thanks

  • Checking the object type

    Hello,
            I want to check a reference variable is of type CL_GUI_DOCKING_CONTAINER   or   CL_GUI_CUSTOM_CONTAINER.
    FOR e.g in java we have instanceOF keyword . How can we find in abap

    I don't have another solution off the top of my head. I am sure I could find one with a little research, but I am not going to because:-
    1. You have not given me enough information. i.e. I know what version you are not on - but I don't know what version you are on
    2. You have not contributed one piece of useful information for solving your problem since the first post
    3. There is no evidence you have looked for this information yourself
    4. The post is marked as "Answered"
    5. Despite several different people responding to your post you have not indicated any of these responses have helped you
    6. Checking your business card I see you have no real name, no Job Role, you work for no one, you have no relationship with SAP, you have no email address, no telephone number, no address, no recent contributions, no skills (at least according to your skills profile). In short - you do not exist
    7. I have better things to do
    Cheers
    Graham Robbo

  • KKAK - Planned revenue for valuation is zero. Please check the object

    Hi Folks,
    As you can see i have run the KKAKor kka3 for single case  to calcutate Result Analysis. i found this errror but i cant' understand how to solve it, i should calcolate the plan revenue on the Sd order? How? Is it something automatically or mannually.
    How can i run the plan revenue on my Sd doc that as two position 10 / 20. the error is on the first position number 10.
    position 20 seems to be non error,infact with kka3 no errors.
    Thanks
    Pavel

    i supposed ther was the possiblities to attach file......
    forget it...
    Edited by: Pavel tidimo on Dec 10, 2009 3:44 PM

  • Programmatically check the existence of objects in the system

    Hi,
    Is there a way to programmatically check the existence of objects? The idea is I'll accept a list of names of objects and their object types and then programmatically check their existence in the system?
    Can you point me to a resource on how to do it?
    Thanks in advance.
    --Carl

    Hi.
    All custom objects (z, y) being referred to a program. May it be z or y table, data element, domain, sapscript form, function module/group.
    The goal is actually to be able to transport a program from a source machine to a target machine. The objects being referred to from the program must also be transported, of course, for it to run properly. Thus, the need to check the objects' existence.
    Thanks.
    --Carl

  • I can't see the Object Key

    Hi experts,
    I have a problem when I run a Webi on a BW query. If I place a single characteristic in Webi report shows me the key, your text short and medium text, but if I add a measure to Webi don't show me the key, that is, I only see the short text, the medium and measure text. The BW query is based on a Multiprovider. I'm working on BO and BW 3.1 are 7.1 SP3
    Greetings & regards,
    Leonel

    Hi Sven,
    Yes, I have checked, the objects exists. The problem is more complex, in BO DEV working properly, but over the BO PRD objects  fails. This trouble is present only where the BW InfoObjects of type NUMC. Another difference is that the environment
    DEV:
    BW 1.7 SP 5 and BO 3.1
    PRD:
    BW and BO 7.1 3.1 SP 9 SP3
    Any suggestions?
    Greetings,
    Leonel

  • Problem while migrating the extensions from one instance to the other.

    Hi,
    We are using kintana workbench to migrate the objects from one instance to the other. But after migrating From Instance1 to Intance2 it ws fine. Working properly in Instance2. But when the same package is migrated to Instance3, all are migrated successfully and log files are showing proerly. But when i access the pages in Instance3, I am getting the errors on the page above like this:
    ViewObject attribute is null; ViewUsageName: (ScorecardSummaryVO1); RegionItem: (LastUpdateLogin)
    Can some let me know what could be the problem.
    Thanks.

    user555006,
    Error shows that LastUpdateLogin item on the page has no proper VO attribute attached. Hence it seems that the MDS data is not updated properly. Upload the page again and test.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How could we assign customized function module to the object

    Hi Experts,
    How could we assign z made function module to the object type.
    for instance, i have prepared one z function module and want to assign segment builder.
    Please help in this regard
    Thanks
    Mahesh Babu

    Hi Thiru,
    Standard Transaction Codes, have their own Function Modules for generating Outbound/Indbound Idocs. Where these Function Modules will be configured to a particular Process Codes.
    For E.g for PO's
    Process code : ME10 - IDOC_OUTPUT_ORDERS - for creation
    In case if its a Z Function Module, It depends on the case how you use IDOC types. either directly through Z Program or through Inbound/Outbound Process  codes with respective Function modules.
    Regards,
    Anbalagan

  • Activation error due to the missing objects in shadow instance.

    Hello All,
    We have problem with our NW701 -> NW730 upgrade. In phase ACT_UPG there is problem with activation of two tables ->
    1EEDO519 "Table" "/BI0/PRSTT_EID" could not be activated
    1EEDO519 "Table" "/BI0/PRSTT_OBJNM" could not be activated
    The problem is that the data elements which are used in this tables were not mirrored into shadow instance. These 3 data elements are missing ->
    /BI0/OIRSTT_FDATE
    /BI0/OIRSTT_FTIME
    /BI0/OIRSTT_SSYS
    In the logfile CUSTEXP.IWY there is following error message ->
    3 EUG166 Unknown message with "R3TR" "DTEL" "/BI0/OIRSTT_FDATE" "0RSTT_FDATE"
    3 EUG166 Unknown message with "R3TR" "DTEL" "/BI0/OIRSTT_FTIME" "0RSTT_FTIME"
    3 EUG166 Unknown message with "R3TR" "DTEL" "/BI0/OIRSTT_SSYS" "0RSTT_SSYS"
    Worse is that in the log CUSTEXP.IWY we can see that 179 objects has the same error message and these objects do not exist in shadow instance.
    When I try "where used" button on data element /BI0/OIRSTT_FTIME in SE11 I get the list of structures where it is used, for example structure /BIC/CE8OMIS_VS. This structure /BIC/CE8OMIS_VS exists in shadow instance and is active but the data element /BI0/OIRSTT_FTIME is missing! And if I check the consistency of the structure in SE11 I receive an error about missing data element.
    I dont think this is ok, and there could be more objects which seems to be activated but if some of the data elements or domains etc... is missing there is a problem. I have opened OSS message for this but maybe someone from you have experience with such behavior and can help.
    Thank you.
    Regards,
    JM

    Hi Manish Patel,
    I have received an answer from SAP :
    I have confirmed with our BW-SYS-DB expert, actually the affected
    objects ("*RSTT*") are part of the technical content. We deliver with
    the technical content our interbal trace tool. Obviously part of the
    trace tool is inconsistent in your system and as it was never used the
    problem was not visible before the upgrade.
    To proceed, please skip the errors ( the objects are absolute not
    necessary for running BW ) and after the upgrade is finished please
    activate the technical content. The missing objects must be created
    by the activation.
    So I have skipped the activation of these objects and I am continuing ...

Maybe you are looking for