What are the algorithem and container to be used for this problem?

Say I have a class with the following properties:
groupMonth //String (jan,feb,mar�)
accumulatedLasyYear //double
accumulatedThisYear //double
What will be the best container/algorithm to use for objects from the class above so I can have them sorted by month (I know it�s a string) AND GROUP the months together (and the accumulated as well)
Example:
Jan 4 8
Feb 2 3
Mar 5 2
Jan 3 5
Feb 4 2
Mar 9 3
The output should be:
Jan 7 13 //(4+3, 8+5)
Feb 6 5
Mar 14 5
Thanks for any thought�

I'd suggest a java.util.Map<String, Set<WhateverClassYouveDefined>>. The keys are the year, the values are Sets containing all objects of that year. Iterate through your list of objects and group them into the right set using the map.
Then I'd suggest looping through the keys to get each month's worth. Since you know what all the keys will be in advance, and there's only twelve of them, create an array of the twelve month strings. Loop through that array, and for each value grab the corresponding Set from the map.
Then for each set you get, iterate through its contents, get the values, and add them.
Then just print the month and the sums of values from the set, and go on to the next month.

Similar Messages

  • What is the AlwaysFilter and when it is used for?

    What is the AlwaysFilter and when it is used for?
    Could you explain it in the details.
    Thank you

    jetq wrote:
    Sorry.
    cache.aggregate(AlwaysFilter.INSTANCE, new LongMin("getAge"))
    That doesn't really help.
    Where does AlwaysFilter come from? Is it part of the core API, or a 3rd party library? If the latter, which one? And in what do the API docs for this class not answer your question?

  • What are the steps and how to run payroll for a person?

    Hi all,
    I have hired a person.  Hired with begda 01/01/2009.
    I have assigned the person to 0001, 0002, 0006, 0008.
    For this person how can I run payroll?
    Help me with the steps from begin of employee hiring to the employee payroll run.
    So that I can check the hired person payroll results in pc_payresult tcode.
    Thanks,
    Venkata

    Hi,
    Please check
    http://help.sap.com/saphelp_47x200/helpdata/en/69/317235acfa2b5ee10000009b38f839/frameset.htm
    Regards,
    Param

  • What are the charges, and who pays if I send a text overseas?

    What are the charges, and who pays if I send a text overseas?

    You pay as part of your cellular/telephone bill unless you use Wi-Fi which is free.

  • HT204053 What are the pros and cons of 1) choosing to use the SAME Apple ID for iCloud services on one side, and purchases on the iTunes Store, App Store, and iBookstore, on the other side; or 2) to have and use two separate Apple Ids for these "two sides

    All is in the title, so I repeat it below with a better identation.
    What are the pros and cons of
    1) choosing to use the SAME
                                                  Apple ID for iCloud services on one side, and
                                                  purchases on the iTunes Store, App Store, and iBookstore, on the other side; or
    2) to have and use two separate Apple Ids for these "two sides"?
    P.S.
    I have loads and loads of free podcasts in iTunes in my iMac, that are certainly more thant the 5 gigas the iCloud provides for free, so I don't want those to go to the cloud. But this is perhaps a different question...
    Also need to mention that I have itunes on a mac, a pc and an iphone.
    Sorry to look so silly with this question, but I don't get the "big picture".

    You need to create a user account for your wife (or yourself depending on who has the current user account). When syncing, each of you should sign in as a separate user, login to iTunes and then sync. I had this problem when my sister got an iPhone. When we did her initial sync, everything on my iPhone showed up on hers. Apple gave me this solution.

  • What are  the tables and fields  in fico & sd module

    what are  the tables and fields  in fico & sd module

    Hi,
    <b> Sales and Distribution:</b>
    Customers KNA1 General Data
    KNB1 Customer Master – Co. Code Data (payment method, reconciliation acct)
    KNB4 Customer Payment History
    KNB5 Customer Master – Dunning info
    KNBK Customer Master Bank Data
    KNKA Customer Master Credit Mgmt.
    KNKK Customer Master Credit Control Area Data (credit limits)
    KNVV Sales Area Data (terms, order probability)
    KNVI Customer Master Tax Indicator
    KNVP Partner Function key
    KNVD Output type
    KNVS Customer Master Ship Data
    KLPA Customer/Vendor Link
    Sales Documents VBAKUK VBAK + VBUK
    VBUK Header Status and Administrative Data
    VBAK Sales Document – Header Data
    VBKD Sales Document – Business Data
    VBUP Item Status VBAP Sales Document – Item Data
    VBPA Partners
    VBFA Document Flow
    VBEP Sales Document Schedule Line
    VBBE Sales Requirements: Individual Records
    SD Delivery DocumeLIPS Delivery Document item data, includes referencing PO
    LIKP Delivery Document Header data
    Billing Document VBRK Billing Document Header
    VBRP Billing Document Item
    SD Shipping Unit VEKP Shipping Unit Item (Content)
    VEPO Shipping Unit Header
    <b>Financial Accounting</b>
    FBAS             Financial Accounting “Basis”
    BKPF             Accounting Document Header              BUKRS / BELNR / GJAHR
    BSEG             Accounting Document Segment             BUKRS / BELNR / GJAHR / BUZEI
    BSIP             Index for Vendor Validation of Double   BUKRS / LIFNR / WAERS / BLDAT /
                     Documents                               XBLNR / WRBTR / BELNR / GJAHR / BUZEI
    BVOR             Inter Company Posting Procedure         BVORG / BUKRS / GJAHR / BELNR
    EBKPF            Accounting Document Header (docs from   GLSBK / BELNR / GJHAR / GLEBK
                     External Systems)
    FRUN             Run Date of a Program                   PRGID
    KLPA             Customer / Vendor Linking               NKULI / NBUKR / NKOAR / PNTYP
                                                             / VKULI / VBUKR / VKOAR
    KNB4             Customer Payment History                KUNNR / BUKRS
    KNB5             Customer Master Dunning Data            KUNNR / BUKRS / MABER
    KNBK             Customer Master Bank Details            KUNNR / BANKS / BANKL / BANKN
    KNC1             Customer Master Transaction Figures     KUNNR / BUKRS / GJHAR
    KNC3             Customer Master Special GL Transactions KUNNR / BUKRS / GJAHR / SHBKZ
                     Figures
    LFB5             Vendor Master Dunning Data              LIFNR / BUKRS / MABER
    LFBK             Vendor Master Bank Details              LIFNR / BANKS / BANKL / BANKN
    LFC1             Vendor Master Transaction Figures       LIFNR / BUKRS / GJHAR
    LFC3             Vendor Master Special GL Transactions   LIFNR / BUKRS / GJHAR / SHBKZ
                     Figures
    VBKPF            Document Header for Document Parking    AUSBK / BUKRS / BELNR / GJHAR
    FBASCORE         Financial Accounting General Services “Basis”
    KNB1             Customer Master (Company Code)          KUNNR / BUKRS
    LFA1             Vendor Master (General Section)         LIFNR
    LFB1             Vendor Master (company Code Section)    LIFNR / BUKRS
    SKA1             G/L Account Master (Chart of Accounts)  KTOPL / SAKNR
    SKAT             G/L Account Master (Chart of Accounts – SPRAS / KTOPL / SAKNR
                     Description)
    MAHNS            Accounts Blocked by Dunning Selection   KOART / BUKRS / KONKO / MABER
    MHNK             Dunning Data (Account Entries)          LAUFD / LAUFI / KOART / BUKRS /
                                                             KUNNR / LIFNR / CPDKY / SKNRZE /
                                                             SMABER / SMAHSK / BUSAB
    FI-GL-GL (FBS)   General Ledger Accounting: Basic Functions- G/L Accounts
    SKAS             G/L Account Master (Chart of Accounts – SPRAS / KTOPL / SAKNR / SCHLW
                     Key Word list)
    SKB1             G/L Account Master (Company Code)       BUKRS / SAKNR
    FI-GL-GL (FBSC)  General Ledger Accounting: Basic
                     Functions - R/3 Customizing for G/L Accounts
    FIGLREP          Settings for G/L Posting Reports        MANDT
    TSAKR            Create G/L account with reference       BUKRS / SAKNR
    FI-GL-GL (FFE)   General Ledger Accounting: Basic
                     Functions - Fast Data Entry
    KOMU             Account Assignment Templates for G/L    KMNAM / KMZEI
                     Account items
    FI-AR-AR (FBD)   Accounts Receivable: Basic Functions - Customers
    KNKA             Customer Master Credit Management :     KUNNR
                     Central Data
    KNKK             Customer Master Credit Management :     KUNNR / KKBER
                     Control Area Data
    KNKKF1           Credit Management : FI Status data      LOGSYS / KUNNR / KKBER / REGUL
    RFRR             Accounting Data – A/R and A/P           RELID / SRTFD / SRTF2
                     Information System
    FI-BL-PT         Bank Accounting: Payment (BFIBL_CHECK_D)  Transactions – General Sections
    PAYR             Payment Medium File                     ZBUKR / HBKID / HKTID / RZAWE /
                                                             CHECT
    PCEC             Pre-numbered Check                      ZBUKR / HBKID / HKTID / STAPL
    FI-BL-PT-AP(FMZA)Bank Accounting: Payment Transactions – Automatic Payments
    F111G            Global Settings for Payment Program for MANDT
                     Payment Requests
    FDZA             Cash Management Line Items in Payment   KEYNO
                     Requests
    PAYRQ            Payment Requests                        KEYNO
    Hope this solves your concern...
    Regards,
    Habeeb
    Assign points if helpful

  • What are the pros and cons of installing java+abap stack for portal?

    Hi all,
      1.What are the pros and cons of installing java+abap stack for portal?
      2.what effect it does on the ume options to be choosen??
      3.for the purpose of integration of r3,bw and crm on portal and crm 4.0 60.2.3 business package which option of stack(java or abap or both)will be good option and which ume option while installation should be choosen?
    regards
    Rajendra

    Hi Rajendra,
    The NetWeaver Installation Master Guide offers some good scenarios on the pros and cons:
    https://websmp201.sapag.de/~sapidb/011000358700005412792005E.pdf
    In a nutshell:
    ABAP+JAVA
    Pros
    - Decrease # of servers required to administer the portal
    - Less costly
    Cons
    - Upgrades could be dependent on ABAP and Java release level
    - Additional load on the server due to ABAP stack
    - Limited scalability
    JAVA and ABAP on separate server
    Pros
    - Improved performance
    - Allows each system to be single-use purpose therefore downtime does not affect other components
    - More scalable
    Cons
    - Adds complexity to landscape
    - Additional costs
    Regards,
    Thomas Pham

  • What are the cause and fix for the following error message? NS_ERROR_FILE_ACCESS_DENIED failure code: 0x80520015

    Every time I close my Firefox browser I receive the following error message (see details below).
    FYI:
    -- I am running the current version of Firefox.
    -- I had no problems with this error message until my computer was recently attacked by 2 viruses:
    ` SystemFix
    ` Win7 Antivirus 2012
    Both viruses have since been cleaned from my computer. However, I am still receiving this error message.
    Here are my questions:
    * What are the cause and fix for this problem?
    * Do I need to uninstall and reinstall Firefox?
    * Is it possible that this error message is related to an add-on and that it has nothing to do with the recent virus attacks?
    I look forward to any feedback and support you might be able to provide.
    Thanks,
    Metta
    Error Message
    NS_ERROR_FILE_ACCESS_DENIED
    Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)
    [nsIFileOutputStream.init]
    File: undefined
    Line: 857
    Stack: undefined

    Every time I close my Firefox browser I receive the following error message (see details below).
    FYI:
    -- I am running the current version of Firefox.
    -- I had no problems with this error message until my computer was recently attacked by 2 viruses:
    ` SystemFix
    ` Win7 Antivirus 2012
    Both viruses have since been cleaned from my computer. However, I am still receiving this error message.
    Here are my questions:
    * What are the cause and fix for this problem?
    * Do I need to uninstall and reinstall Firefox?
    * Is it possible that this error message is related to an add-on and that it has nothing to do with the recent virus attacks?
    I look forward to any feedback and support you might be able to provide.
    Thanks,
    Metta
    Error Message
    NS_ERROR_FILE_ACCESS_DENIED
    Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)
    [nsIFileOutputStream.init]
    File: undefined
    Line: 857
    Stack: undefined

  • What are the entities that can be re-used in different servers, SI App, SI instance? And how?

    Greetings,
    What are the entities that can be re-used in different servers, SI App, SI instance? And how?
    e.g. can I use a deployed IQStreamable@app1  into app2?
    can I use a deployed observable/app1/siInstance1/Server1 into another query/app3/siInstance3/server2?
    On the presentation titled "04 – Installing, Deploying and Maintaining the SQL Server 2008 R2 StreamInsight Runtime Engine" with file name SQL10R2UPD05-DECK-04.pptx on ecn.channel9.msdn.com/o9/learn/SQL2008R2TrainingKit/Presentations/SQL10R2UPD05-DECK-04/SQL10R2UPD05-DECK-04.pptx
    It is mentioned one of the deployment option is "Deployment: Standalone Server"
    and it mention the following:
    "Use this option for the following scenarios:
    - Metadata objects need to be shared between applications
      - Event Types
      - Adapter Types
      - Query Templates
    - A data source registered with the server provides an event stream for another existing application"
    Could you please provide good example that explain the above statement?
    Cheers, Muhammad

    First, that statement - and those materials - refer to the "legacy" StreamInsight query/adapter model. They do not refer to how things work with the Reactive model introduced in version 2.1. Specifically, it talks about Dynamic Query Composition (DQC).
    You cannot use a deployed Observable in another instance of StreamInsight. You may be able to use them across applications in the same instance - off the top of my head, I'm not sure. I'm getting ready to get on a plane but will take a look at it later.
    Typically, however, applications act as containers (comparable to .NET AppDomains) so I don't think that you'd be able to do this easily. That said, the code and assemblies
    can be reused across multiple instances/applications. You would have separate instances of the classes involved but you would be able to reuse the query logic. That's a common use case.
    Can you be more specific about your use case and what you are trying to accomplish here? It's possible that there are alternative ways to do what you are trying to do.
    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)
    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

  • What are the names and the parameters of the SSIS reports

    what are the names and the parameters  of the SSIS reports
    (delivered with and included in the SSMS)
    to navigate from my reports to the build in reports
    it's necessary to know the reportname and the parameters.
    I want to "combine" respectively want to navigate
    from custom reports (works excellent) to the 5 build in reports
    please have a look at the attached picture and in particular
    to the blue arrow.SSIS_ReportsNavigation
    thank you for providing an answer or a hint.

    to navigate from my reports to the build in reports
    Those integrated reports in SSMS are not hosted in SSRS, so there is no URL available where you can navigate to.
    The reports run in client side rendering mode = RDLC.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • What are the advanteges and disadvanteges of using pl/sql over hibernate

    i knwo that pl/sql are well structure and provide a lot of functionalities with oracle databse , but my question is the hibernate might give some advnateges of scalability over pl/sql.
    so what are the advanteges and disadvanteges of using pl/sql over hibernate?
    and does oracle recommend using hibernate for connecting JSP with oracle 11i , or it is better to connect the JSP pages with oracle databse using pl/sql ?

    812643 wrote:
    but if i search for the diferencess then there are a lot of opinions about this ..., specially when they say that with hibernate you can integrate with any DB , and it provides object printed architecture, etc.All databases are not equal. This is a basic and fundamental fact. SQL-Server is not Oracle. Oracle is not SQL-Server. As it is the case with Sybase, Ingres, DB2 and other database products. They are all different. And there are some very core differences between them.
    So how would a product like Hibernate treat these database products with their differences? By using the lowest common denominator. Which means your expensive database product is dumbed down - and even MS Access will likely have better and more features.
    You also need to decide what is the "permanent" part in your architecture. What is going to the core? What is the expensive part? The app server (with Hibernate)? Or the database server?
    What are you likely to change next year? The app server server? Or the database server?
    In the vast majority of cases, the core is the database server. That is your biggest expense and investment. As it should be - as it holds that which is most precious to business, data. You want to ensure the integrity of that data. The accuracy of that data. Make sure that it can be easily backed up and recovered. Is flexible to use. Etc. Etc.
    The database server is the core - and that is where you need to realise your return on investment. By using the database server to its full extent.
    Hibernate does not do that. And in that respect, it is junk.
    Why does it not do that? Because many Java developers are totally and fully clueless about what database servers are and how to use them. And want to use them as little plug-in black boxes - bit buckets that are only there to provide a data persistence layer. Instead of using the database server to its full extent, they instead use Hibernate, and try to do their own "+database thing+" in the app layer - and do it poorly and with utter lack of any scalability. (and no, only ignorant Java heads think that scalability means throwing more money and h/w at it)
    My largest database processes billions of rows per day, every day, 356 days a year (between 350 to 450 million new inserts into a single table per day). And have been for several years now. It does so using PL/SQL. Using Oracle to its full extent. Then there are Java heads that cannot even design and code an app that effectively process 1% of this volume... and grasp at straws like Hibernate and other Java cr@p to "fix" this - when the actual problem is their total lack of ignorance in how to use and scale the database server.
    Hibernate is trash - and a symptom of Java developers's ignorance of database technology.

  • For getting purchase order details what are the inputs and outputs

    I need to display purchase order details in EP portal by using integration EP, XI and R/3.
    I dont know what are the Inputs and what are the Outputs.
    Reward points for helpers.
    Cheers,
    Preethika

    Hi Preethika,
    for displaying PO use BAPI : BAPI_PO_GETDETAIL
    Its input is PO number
    Its output are tables PO_HEADER_TEXTS - for PO header data
    PO_ITEMS - for PO line items
    Thanks,
    Rajeev Gupta

  • What are the pros and cons re using an intel iMac vs MacPro with LP8?

    I'm considering getting a new intel Mac in the near future (presuming a new MacPro will be released in the near future - maybe at the same time as Leopard). I compose largely for film and television and I am composing largely using a combination of loops, software instruments and some recorded live performance. I usually sync to a low res quicktime movie.
    I do like the idea of a simple and uncluttered work environment with an iMac, added to which there's also a degree of portability with the iMac however the MacPro is obviously more powerful. I'm not sure how much the difference in power between the two computers would affect me.
    Would I be compromising myself much if I went for the iMac over the MacPro? What are the pros and cons of the iMac vs the MacPro in relation to Logic Pro 8?

    In the world large-scale music composition using samples, loops, etc (especially for film) your two biggest needs are RAM and HD speed/access. The imac looses big time in this department (as a single computer at least) as it can only be upgraded to 4gb ram, and only holds one internal HD, and also lacks any PCI expansion for DSP cards, audio interfaces, etc.
    In generalyou want to separate your data vs applications as much as possible, to ensure both can be accessed quickly and easily by the computer. So its best to have your system software / applications on one internal HD, and your logic data (samples, audio recordings, loops) on another drive(s). You can do this with an iMac via USB, FW800, & FW400, but depending on how big your projects get, how many USB and FW drives / interfaces you use, and how much data you need to stream, you could overload the buss on the imac (not sure if it has multiple busses or not). Plus speed wise, internal SATA are much faster than external drives, and the mac pro with its 4 internal slots seems like a great choice for speed and flexibility.
    However, if you dont find yourself doing large scale projects, then you might be better off going with an imac. We just purchased one for my father and it runs great! It blows the socks off of my Dual 2.5 G5 tower in terms of CPU speed! If you run into problems running things from the imac, you could always add a mac-mini down the road to stream sample libs, as a Logic node, etc, which seems to be a much more cost effective solution.
    I hope this was helpful, but I probably just made the decision harder . In fact, if I were to start over today, I dont know if I'd go with a MacPro, or an iMac / mac mini combination. they both seem to have their advantages / disadvantages.
    Best of luck!

  • The answer helped me.But still, what are the settings that I have to change for the behavior of the mouse pointer towards finder? Also the mouse pointer sometimes  doesn't accept my command and start clicking itself.what is the problem and how to fix it?

    The answer helped me.But still, what are the settings that I have to change for the behavior of the mouse pointer towards finder? Also the mouse pointer sometimes  doesn't accept my command and start clicking itself.what is the problem and how to fix it?

    If the mouse clicks something on its own then it looks like you have a hardware problem with the trackpad or possibly the battery that is right underneath the trackpad.
    I have read that the battery can swell and that would put pressure on the trackpad.

  • What are the production and marketing concepts of Apple?

    What are the production and marketing concepts of Apple?

    FelixWinter wrote:
    What are the production and marketing concepts of Apple?
    To produce and sell as many devices as possible.
    Seriously, you will have to ask Apple. We are just users like you. You can contact Apple using the Contact Us link at the bottom of these pages. But I don't think you will get a response, but I may be wrong.

Maybe you are looking for