Searching for objects in collection

I have a employee data base with 4 attributes
empid, ename,yearofjoining,deptnumber
i want to create a program/data structure, where by i can esily retrive
1) number of employees joining in a given year
2) number of employees joining in a given department in a given year
Please suggest

relaxedgalaxy wrote:
What i am looking for is which collection should i use, Set/List/Map etc..Well.
Does your data structure allow duplicate entries (i.e. is it meaningful if one element is contained twice in there?)
Does the order of elements in your data structure matter?
Is your data structure something that maps some key to some value?
which one of these are most efficient in terms searching timeDoes that matter? Is that part of the assignment?
And just because:
class Employee {
  int empId
  String name
  int yearOfJoining
  int departmentNumber
  String toString() {
    String.format("Employee #%d: %s (%d, dept. %d)", empId, name, yearOfJoining, departmentNumber);
def emps = [
  new Employee(empId: 1, name:"Foo", yearOfJoining:1980, departmentNumber: 1),
  new Employee(empId: 2, name:"Bar", yearOfJoining:1979, departmentNumber: 1),
  new Employee(empId: 3, name:"Baz", yearOfJoining:1980, departmentNumber: 2),
println emps
println emps.findAll({ it.yearOfJoining == 1980 }).size()
println emps.findAll({ it.yearOfJoining == 1980 && it.departmentNumber == 1}).size()(I always wondered why there is no Collection.count(Closure) in Groovy. .findAll(Closure).size() seems so .... un-groovy)

Similar Messages

  • Search for objects in database by name

    Want to search packages, views, table, functions for an object name 'company_search' . What is the query from data dictionary?
    Thanks

    user568155 wrote:
    Want to search packages, views, table, functions for an object name 'company_search' . What is the query from data dictionary?
    ThanksThere are several data dictionary views you can reference, including
    * DBA/ALL/USER_OBJECTS
    * DBA/ALL/USER_VIEWS
    * DBA/ALL/USER_SOURCE (may contain text internally in the TEXT column)
    * DBA/ALL/USER_ARGUMENTS
    You will have to search the _SOURCE view line by line for packaged procedures and functions.  To search packages you will have to loop through the source lines one by one to search for the text you want
    A query would look something like
    select object_name
      from dba_objects
    where object_name like '%COMPANY_NAME%';Edited by: riedelme on Sep 20, 2012 9:02 AM

  • Search for Objects via Class Hierarchy

    Dear colleagues,
    For searching of an Object via a Class Hierarchy, Program SAPLCLSD screen 1000 release 4.7, a double click is required on the Class (left side of the screen) from which you want to see the Objects. If you do not click double, the view of the related Objects will not be recreated.
    Is it possible to avoid the double clicking?

    Hello Alpesh,
    Thank you for your response. The user asked whether the double click, needed for the show of the objects, related to a Class, can be done with a single click.
    They use transaction CL20N, input Class type, search for material with F4 search by Class input of a Class, then a tree of Classes will be shown. Select a Class, use button 'Include subordinate classes' and, if available, the related object(s) are shown.
    The issue is that when you select another Class, you have to double click on the selected Class to make the screen with Objects empty.
    Can we change the double click easy to a single click?
    Kind regards, Jan van der Veen.  06-22973646 Netherlands.

  • Search for objects assigned to "My Group" (Higher Duties)

    When searching for Business transactions Assigned to "My Group", when the user is CP Holds (higher duty) the user can only see the transactions assigned to his position like Owner (Business Partner), but not the transactions for the higher duty.
    We're using organization chart with integration with SAP ECC HR. In HR a Higher Duties is when an employee work for a period, in a position, which is not his or her own. This is a position with a higher classification and the employee receives a higher remuneration for this assignment. In CRM the IDOC synchronize correctly the employee in new position with the relationship "Higher Duty" in the organization chart.
    However, for this new assignment in the organization chart, when the user search the document assigned to "My Group", the system only show the document for the normal position and not for the Higher duty position.

    Answer from SAP: Higher duty is not supported by SAP in SAP CRM.
    However is a valid infotype in SAP ECC

  • Search for objects assigned to "My Groups"

    Hi guys
    In CRM 5.0, When searching for Business transactions Assigned to "My Groups", the user can only see the transactions assigned to the same organization units, but not the transactions for the subordinate organizational unit.
    Any idea?
    Regards,
    Lyda

    Hello Lyda,
    Som good information is contained in the 85 page FAQ attachment to SAP Note 882653, "Frequently Asked Questions about Agent Inbox". You might want to have a look at the mentioned BADI...
    "In case you have selected u201CMy Groupsu201D all employees of any group you are part of are taken into account. Your HR model therefore has a significant impact on the outcome of an inbox search. The responsible group displayed is not taken into account for the search!
    If you need another logic here, you may filter the search result using method AFTER_SEARCH of the CRM_IC_INBOX_BADI business add-in on  a project base."
    Best regards,
    John

  • Search for object problem in LV 2013

    Search does not find objects in lvlib. 13.0.1 and 13.0.1f2, Windows 7.
    First try:
    Open the search dialog
    Select 'Objects' radio button
    Select my project as 'Application Instance:"
    Click 'Select Object' button and browse to functions/file io/config file VIs/Open Config Data.vi
    Search Scope is 'All VIs...'
    Uncheck 'Ignore VIs in vi.lib'
    Click 'Find'
    Results list is empty.
    At least one vi with the search target was already open.
    Second try:
    Open a VI with the above referenced VI
    right click 'Open Config Data.vi'
    select 'Find all Instances'
    Results list shows all instances across several files
    Observation:
    Using my first search method, the name of the vi is 'Open Config Data.vi'
    Using the second search method, the name of the vi is 'NI_LVConfig.lvlibpen Config data.vi' - note full path
    Am I doing something wrong with my first search method?

    Hello Les__Bartel
    Your question: Am I doing something wrong with my first search method?
    You could try:
    -Open the search dialog
    -Select 'Objects' radio button
    -Select my project as 'Application Instance:"
    -Click 'Select Object' button and browse to objects in vi.lib>>select NI_LVConfig.lvlibpen Config Data.vi
    -Search Scope is 'All VIs...'
    -Uncheck 'Ignore VIs in vi.lib'
    -Click 'Find'
    -Results list shows all instances across several files
    Same result as your second try.
    Regards
    Frank R.

  • Searching for Nonprinting Objects

    Is it possible to do a search for objects with an attribute set to Nonprinting?
    I have this odd problem:  I work on a magazine, and we insert a little custom endmark image at the end of each story.  For some reason, whenever anyone edits that story in InCopy, the endmark's attributes change to Nonprinting.  I can't figure it out.  But I was wondering if there's an easy way to search on Nonprinting so I can quickly change them back.  Any ideas?
    Thanks, Phyllis

    Haven't tested it yet, so be careful - perhaps do a Save As first
    This might work...shot in the dark
    Take one of the Inline Objects and give it an Object Style.
    Make sure the Object Style is highlighted in the Panel when you have the inline object selected.
    Now go to the Attributes Panel - and untick "Non Printing"
    You will see the Object Style get a + beside it - you can now Redefine that style
    Find and go to the Object tab
    Find Object Format > Anchored Objects Inline
    Change to
    Select the Object Style

  • Search API for searching Business Objects in SAP R/3

    Hi All,
    As per my requirement i need to search Business Objects from a third party application by writing some java code.
    I know only JCO which is useful for to establish a connection from Java to SAP Server and execute the RFC's or BAPI's which are reside in SAP Server.
    Can any one help me, it is possible or not to search Business Objects in SAP for example Master Data( Like Employee, Vendor, Customer-) or Transactional Data ( like Sales Order, Purchase Order--), in case if it is possible any Search API is there to use on SAP System and what are the Prerequisites and the Feasibilty.
    Its urgent---PLZ help me how to resolve this issue
    Thanks in ADV
    Regds
    Rajesh

    Hi,
    Good evening and greetings,
    Please go through the following link
    http://help.sap.com/saphelp_erp2004/helpdata/en/0d/afb8f627878b4fa71ac79508f2358a/frameset.htm
    Please reward points if found useful
    Thanking you
    With kindest regards
    Ramesh Padmanabhan

  • IE02 services for object- How to collective list attachment by many equip?

    Hi all,
    IE01/IE02  i create attachment by services for object for equipment.
    But I want to collective  list attachment by equipment, not by individual  equip to display.
    How to do that?  or which table can i find the info?
    thanks a lot

    derek,
    I don't think there are any [Generic Object Services|http://help.sap.com/erp2005_ehp_04/helpdata/EN/be/3fe63659241157e10000009b38f889/frameset.htm] (GOS) transactions to mass update objects...
    I suspect you would need to develop a custom BDC program for this purpose.
    PeteA

  • [Forum FAQ] The Value drop down list is grayed out when you perform search for Group Policy Objects in GPMC

    Symptom
    On Windows Server 2012 or Windows Server 2012 R2, when you use the Search for Group Policy Objects feature in GPMC, the “Value” field is not populated when you choose “User Configuration” as the Search Item. (See Figure 1.)
    <Figure 1>
    Cause
    The happens because the  Data of the (Default) value of the following Registry Key is not correct.
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\{4D2F9B6F-1E52-4711-A382-6A8B1A003DE6}]
    By default the Data is (value not set). (see Figure 2)
    <Figure 2>
    Resolution
    The registry keys under [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions] are the Group Policy Preference Client Side Extensions. The CSE name of the GUID {4D2F9B6F-1E52-4711-A382-6A8B1A003DE6} is
    RemoteApp and Desktop Connections. Please follow the steps below to resolve the issue.
    1. Locate the registry key: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\{4D2F9B6F-1E52-4711-A382-6A8B1A003DE6}]
    2. Take the ownership of this key: Right click on the registry key and choose Permissions option and click the Advanced button on the dialogue window. Then on the Advanced Security Settings dialogue window, click Change button to take the ownership
    of the key for the current logon account and make the current logon account Full Control permission with the registry key. (See Figure 3.)
    <Figure 3> 
    3. Change the data of (Default) value from "(value not set)" to
    "RemoteApp and Desktop Connection Component". (See Figure 4)
    <Figure 4>
    4. Once the steps above are completed, the Value drop down list will be populated again when you perform Search in GPMC. (See Figure 5)
    <figure 5>
    This article has been created as a TechNet Wiki
    here.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    thanks for the tip - but you should create this as a wiki article as it will be easier to reference in the future
    Regards,
    Denis Cooper
    MCITP EA - MCT
    Help keep the forums tidy, if this has helped please mark it as an answer
    My Blog
    LinkedIn:

  • BOL Search/Query Object for Schema Search!.

    Hi All,
    I have to do search for categorization schemas, as the first step I opened the standard schema search component ( GS_MCAT ) and found that the Dynamic Search Object responsible for the same is:   'MC_DynaQSchemaByAttributes'.
    Now, I have 2 questions 4u
    1.  If I run the BOL browser by giving the component set as 'all' I couldnt see this query!. how can I find
    this in BOL/MODEL browser
    2. Is there any standard BOL Search/Query Object on which I can perform a search on Schema based on the product assigned at the categorization level!.
    Any help/hint highly appreciated!,
    Thanks in Advance, Sudeep..

    Also solved.
    As SAP tends to confuse people with the "ALL" component set, ...
    I debugged the "CL_CRM_CATEGO_GENIL" class. Here's the component set you need to load:
        lv_core->start_up( 'ONEORDER' ).

  • How to search for the particular ABAP Object

    Hi,
    I am using the SAP 4.6C machine, I need to search for the particular ABAP Object. Plz can anyone help me in this.
    Regards,
    Pralhad P. Teggi

    You'll get a better response if you ask a meaningful question.
    If you want to scan for Business Objects (BOR) use transaction SWO1
    For ABAP classes / objects use a combination of transactions SE24 / SE18 / SE19 and /or SE80
    (SE 18 /  SE 19 are for Badi's)
    Cheers
    Jimbo

  • Trex search for business object in portal

    Hi
    I would like to build a KM search iView in portal which enables users to search for business object from backend system.
    I have built up the indices for business object in the backend system. In portal->trex monitor->display index details, I can see the indices which are created from backend system. But soemhow, I feel the indices are not usable, as I can not see them in the indexing monitor. And after I created an KM search iview with search component 'search_input_indexes', my index created from backend can also not be shown in the preview of the iview.
    I guess there is some step missing. Any help will be appreciated.
    Thanks and best regards
    Yingzhi

    Hi Yingzhi,
    with current releases, business objects indexed through the ABAP-based Search Engine Service (SES) or directly from certain SAP solutions to TREX are not by default accessible from KM.
    The next release after NW2004s will enable Enterprise Search and provide the meta-search engine for parallel search access to business objects and KM documents.
    Please see the following presentation for some explanations on SES and Enterprise Search and note stated time-lines:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/73f3eedf-0501-0010-0aa6-950694c02f99
    In some monitors that access TREX directly from the portal, you may see the business object indexes, but they are not actually known to KM.
    Regards, Karsten

  • Urgent pls help!! How to search for an object in vectors?

    Hi,
    I heard that a Vector can store an object right?
    So lets say I created an object called Student that has the attributes: id, name, sex, age
    1) Is vector able to store many students with all these attributes? cos the examples i have seen so far vector only seems to store one attribute
    2) how do i search for sumthin in a vector? let's say i want to key in the student id or his name and find tt student's record to display it?
    thx!

    so sorry... apparantly i didnt copy the last few brackets..
    ===============================================================
    import java.io.*;
    import java.util.*;
    class AddReservation
         static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
         //Main Method
         public static void main (String[]args)throws IOException
              String custName, comments;
              int covers, date, startTime, endTime;
              int count = 0;
              //User can only add one reservation at a time
              do
                   //Create a new reservation
                   Reservation oneReservation=new Reservation();                         
                   System.out.println("Please enter customer's name:");
                   System.out.flush();
                   custName = stdin.readLine();
                   oneReservation.setcustName(custName);
                   System.out.println("Please enter number of covers:");
                   System.out.flush();
                   covers = Integer.parseInt(stdin.readLine());
                   oneReservation.setCovers(covers);
                   System.out.println("Please enter date:");
                   System.out.flush();
                   date = Integer.parseInt(stdin.readLine());
                   oneReservation.setDate(date);
                   System.out.println("Please enter start time:");
                   System.out.flush();
                   startTime = Integer.parseInt(stdin.readLine());
                   oneReservation.setstartTime(startTime);
                   System.out.println("Please enter end time:");
                   System.out.flush();
                   endTime = Integer.parseInt(stdin.readLine());
                   oneReservation.setendTime(endTime);
                   System.out.println("Please enter comments, if any:");
                   System.out.flush();
                   comments = stdin.readLine();
                   oneReservation.setComments(comments);
                   count++;
              while (count<1);
              class Reservation
              private Reservation oneReservation;
              private String custName, comments;
              private int covers, startTime, endTime, date;
              //Default constructor
              public Reservation()
              public Reservation(String custName, int covers, int date, int startTime, int endTime, String comments)
                   this.custName=custName;
                   this.covers=covers;
                   this.date=date;
                   this.startTime=startTime;
                   this.endTime=endTime;
                   this.comments=comments;
              //Setter methods
              public void setcustName(String custName)
                   this.custName=custName;
              public void setCovers(int covers)
                   this.covers=covers;;
              public void setDate(int date)
                   this.date=date;
              public void setstartTime(int startTime)
                   this.startTime=startTime;
              public void setendTime(int endTime)
                   this.endTime=endTime;
              public void setComments(String comments)
                   this.comments=comments;
              //Getter methods
              public String getcustName()
                   return custName;
              public int getCovers()
                   return covers;
              public int getDate()
                   return date;
              public int getstartTime()
                   return startTime;
              public int getendTime()
                   return endTime;
              public String getComments()
                   return comments;
              //Display the current reservation
              //public void displayReservation()
         //          System.out.println(custName.getcustName());
         //          System.out.println(covers.getCovers());
         //          System.out.println(date.getDate());
         //          System.out.println(startTime.getstartTime());
         //          System.out.println(endTime.getendTime());
         //          System.out.println(comments.getComments());
    ===============================================================
    import java.io.*;
    import java.util.*;
    class searchBooking
         static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
         public static void main (String[]args)throws IOException
              int choice, date, startTime;
              String custName;
                   //Search Menu
                   System.out.println("Search By: ");
                   System.out.println("1. Date");
                   System.out.println("2. Name of Customer");
                   System.out.println("3. Date & Name of Customer");
                   System.out.println("4. Date & Start time of reservation");
                   System.out.println("5. Date, Name of customer & Start time of reservation");
                   System.out.println("Please make a selection: ");          
                   //User keys in choice
                   System.out.flush();
                   choice = Integer.parseInt(stdin.readLine());
                   if (choice==1)
                        System.out.println("Please key in Date (DDMMYY):");
                        System.out.flush();
                        date = Integer.parseInt(stdin.readLine());
                   else if (choice==2)
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                   else if (choice==3)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                   else if (choice==4)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Start time:");
                             System.out.flush();
                             startTime = Integer.parseInt(stdin.readLine());
                   else if (choice==5)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                             System.out.println("Please key in Start time:");
                             System.out.flush();
                             startTime = Integer.parseInt(stdin.readLine());
              public void           
    }

  • Search in Nakisa doesn't work for objects JF and FN only

    We have ECC 6.0 EhP4 and STVN 2.0 installation.
    We can activate SEARCH for standard O, S and C objects but trying to activate search for JF and FN there are no results.
    We can see while activating Nakisa with trace mode nad chech that there are no results for function: HRTMC_SEARCH_OBJ.

    Hi Zeev:
    The Nakisa searches for SuccessionPlanning all drive off of Enterprise Search in SAP.
    Can you do me a favor and look in transaction ESH_COCKPIT and look at the following 2 search object connectors:
    HRTMC Functional Area
    HRTMC Job Family
    Then over to the right of those, does it show the data is indexed?  If so, how many records are "optimized"?  If that number is 0, then indexing is your issue.  If that number is greater than 0, then I'm guessing you have an authorization issue with the user accessing the data.
    Anyway, we can figure it out based upon what you see.  Let me know when you get time.
    Thanks,
    Chris

Maybe you are looking for

  • Loading Adobe Photoshop on my MacBook Air (2014) without an optical drive

    My lab at the University already has Adobe Photoshop. I am wondering how do I download it on my new MacBook Air (2014) without an optical drive. Another query is about the usability of photoshop on MacBook Air. Mine is a 1.4Ghz, 128gb, 8mb (RAM) MAB.

  • How can I get my greyed out photos to show up permanently in iPhoto.

    I recently had to have my HD reformatted.   Am now in process of reinstalling my 3rd party software.    So far so good.   Some of my photos are missing both on my computer and on my time machine.     They appear in my "photos" when I scroll past them

  • JTextField(Document, string, int)

    Dear friends, Could you just tell me how can I fix the size of the JTextField, such as just accept the maximum number of digits or characters in JTextField... I cant create the Document.... Could anyone give me a tips?

  • How to change your security questions if you forgot them?

    I really need help with this I really want to buy apps but I forgot my security question answers

  • ITS Theme Generator on NW2004s

    I am trying to use the ITS Theme Generator on our NW2004s portal via Portal display and I am having problems, even though I have already activated >/sap/bc/gui/sap/its/ on /nSICF and also published SAP_GENERATE on /nSE80. I am using an existing porta