I wanna use a HashMap instead of an array..but how ??

Here's the class I'm using...
public class Group {
     private Student[] list;
     public final int GROUPE_SIZE;
     private float[] finalGrades;
     public Group(int size) {
          GROUPE_SIZE = size;
          list = new Student[size];
     public void addStudents(Student[] list) {
               this.list = list;
     public Student[] getList(){
          return list;
     public void setFinalGrades() {
          finalGrades = new float[GROUPE_SIZE];
          for (int i = 0; i < GROUPE_SIZE; i++) {
          finalGrades[i] = list.getFinalGrade();
          Arrays.sort(finalGrades);
     public float getLowestGrade() {
          return finalGrades[0];
     public float getHighestGrade() {
          return finalGrades[GROUPE_SIZE-1];
     public float getAverage() {
          float total=0.0f;
          for (int i=0; i < GROUPE_SIZE; i++) {
               total+= finalGrades[i];
          return total/GROUPE_SIZE;

I have to replace all the arrays in this class by using the HashMap, but I don't know how
In order to know how, you need to know why.
It looks like your class provides grades for students. Now, a Map (of which HashMap is an implementation) provides for mapping from one object to another. In your case, you probably want to look up students' grades, so your mapping would be "student-->grade"
Read the collections examples linked above and you should be well on your way - but just remember that you need to know the "why" before the "how," otherwise you'll end up in a mess. Understand what it is you're trying to do, what the need is that your code satisfies.

Similar Messages

  • HT204053 I want to change my apple id on the ipad to use the same id on all devices but how?

    How do I change apple ID on a device such as iPad or iPhone?

    Go to "Settings > iCloud" and delete your current account that you do not want to use.
    After that you have the ability to sign in with another Apple ID/iCloud account. Just go to "Setting > iCloud" again and sign in.

  • Same question for the "2 iPhones in one account".....How do I change the name.  My iPhone is showing my wife's iPhone name when I am syncing it.  Why is that?  I know about using one iTunes account....But how do you change the name w/o erasing your data?

    Hi....How do you change the name?  When I sync my iPhone, it shows my wife's name on it?

    Unfortunately it is not doing it....
    Let me give more details..We have 3 iPods and 2 iPhone4....I recently purchased the iPhone4 and when we connected it..It was already reading my wife's iPhone4..We went to the Apple Store at the Grove today and was told to de-authorize the system and connect my iPhone4 back and I should be able to change the name.
    Nothing happened..Right now, I clicked on RESTORE settings...and it is uploading a new iPhone update. 

  • Okay, my gateway laptop crashed about 2 months ago and Im saving up for a new Mac. I want to use my iPhone 4 on the Mac, but how do I do that with out wiping my phoen clean or without my old laptop too. And I am not tech savvy so I need step by step.

    So basically I'm a girl who can't figure out technology. I want my music and apps to stay and I want to be able to update my phone because it still has it's original software.

    Let me see if I've gotten this right! You want to remove an account from BOTH machines? Do this for your new machine first, then for the other.
    Click the Apple logo on the top left of the screen, System Preferences, Users and Groups (under Systems), unlock the lock in the window if its locked (you need to know the password), select the user that you wish to remove, and click the - sign next to the + sign for Login options. A window will pop up with some options. Select Delete this user and securely, and click 'Delete user'.
    After this, do an update from the App Store.
    Thats all there is to it.
    For the other machine repeat the process except for one thing. Before you delete the user in this case YOU, you will have to give Administrator priviledges to your son bu checking the box 'Allow user to administer this computer'.
    Do NOT do anything from Finder ... if you dont know how to fix the consequences of the problems caused.
    There is no need to unauthorize your iTunes account on your new machine. Do it on the old machine though.

  • Using SQL Server instead of OLite

    Has anyone had any luck with this? I am really not too familiar with the Oracle setup and due to experience, feel much more comfortable using SQL Server.
    I read this thread where it talks about using other databases instead of Oracle Lite, but I can't seem to get it to work for SQL Server.
    How to use a non-Oracle database?
    I can get the ddl file to install and configure for SQL, but I'm having problems getting the JDBC connections to work in the data-sources.xml config file. Can anyone PLEASE... help me here? I've been screwing with this for a few hours, and haven't had much luck and I'm getting really frustrated. I downloaded the DataDirect JDBC drivers, but I'm not sure what I need to do with them in order to get this to work.
    Thanks,
    TC

    Hi TC,
    I circled back with the team. The only set of drivers that we currently support for Microsoft SQL Server are the DataDirect drivers. You should be able to download evaluation versions from their web site and their configuration doc do a good job of describing the configuration string you will need to use to set up the data source.
    Let us know if it does not work as advertized.
    I hope this helps.
    Edwin

  • When I imessage it uses my email instead of my name

    When I text other people with an iphone imessage uses my email instead of my name. How do I fix that? One of my friends thought I was spam because of this.

    If you choose not to use your email address, then delete it from there, or go down to caller ID and select the one you want as default.

  • I am having trouble with my hotmail emails and want to get rid of them and start to use icloud emails instead.  Is this possible?

    I am having problems with my hotmail and live emails and want to cancel them and use icloud email instead, is this possible and how do I do it by creating icloud emails, and using icloud emails

    See the link below for how to sign up for and set up an iCloud account, including an @icloud.com email address:
    http://www.apple.com/icloud/setup/
    You'll need to update your Mac OS to 10.7.5 or later.

  • Can I use a MacBook like a Mac Mini? How would I power it on?

    Is it possible to use a MacBook like a Mac Mini when I'm at home, with it plugged into a monitor? I've seen pictures of people using theirs when the MacBook is closed, but how would you power it on? If it's turned off, can it be powered on with the remote? And if not, how would I turn it on without opening it? I don't much fancy leaving it in sleep mode all the time.

    Basically, you have to use sleep mode, either
    with a USB keyboard and/or mouse
    http://docs.info.apple.com/article.html?artnum=86286
    or with bluetooth
    http://support.apple.com/kb/HT1308
    You can use the Energy Saver preferences to set up schedules for automated shutdown (at night), startup (in the morning), and sleep (when idle) settings.
    If it's powered off, just open the lid and power it up, then close the lid again, or get a laptop stand and use both the built-in display and the external display at the same time in extended desktop mode, if you have the desk space.

  • Using SAP PI instead of CRM Middleware

    Hi experts,
    Is it recommend to use SAP PI instead of SAP CRM Middleware.
    If yes how can I do that.
    I have read in forum requests that it can be implemented by using iDOC instead of BDocs.
    I need a technical guideline how data (eg. Business Partner Data) can be tranferred from CRM to other ERP System.
    Thank you for help.
    Greetings
    Mario
    Edited by: Mario Bauer on Jun 22, 2010 9:24 AM
    Edited by: Mario Bauer on Jun 22, 2010 9:28 AM

    Hi!
    SAP PI itself is a middleware Product but very roboust and capable enough to integrate any system to any other system, either it is SAP or Non-SAP. And there are two ways to integrate other ERP System to SAP CRM using SAP PI.
    1. SAP PI will receive the message from back end ERP system & convert it to the XML format. SAP CRM receives the message using the Middleware XIF adaptor and convert the incoming XML Messages in the BDocs and the BDocs upload the data in the SAP-CRM Data base.
    2. SAP PI will receive the message from back end ERP system & convert it to the XML format. SAP CRM receives the message and using the Functional Module convert the data into the  BDocs and the BDocs upload the data in the SAPCRM Data base. In thsi situation, you need an expert ABAP Consultant to write the accurate functional Module.
    The data inside the SAP_CRM System always transported in the BDocs not in Idocs. It is the BDocs data containers which transport the data from CRM Middleware to CRM Database and CRM Database upto CRM Middleware.

  • How do I use openjpa2.0 instead of openjpa1.0

    I use openjpa1.0 provider in weblogic10.3.4 before.
    now I want use openjpa2.0 instead of openjpa1.0.
    I according to this article (http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Problem_2:_JPA_2.0_persistence.xml_XSD_Enablement) to enable jpa2.0 .
    but failed. it throws exception:
    what do i do: seems an odd quirk of the EJB spec. The exception is:java.lang.AbstractMethodError: org.apache.openjpa.persistence.EntityManagerImpl.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
         at com.bea.core.repackaged.springframework.jee.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:111)
    I try to delete openjpa1.0 jar file from modules directory.
    the servier throws java.lang.NoClassDefFoundError org/apache/openjpa/conf/OpenJPAVersion
    it seems the weblogic can't load the openjpa2.0 jar.
    can somebody help me?

    Hi,
    My page quoted above is mostly for older versions of WebLogic 10.3.3.0 and below that could not handle container managed JPA 2.0 injection. For WebLogic 10.3.5.0 and 10.3.4.0 JPA 2.0 is fully functional but will need to be enabled (the best way is to install OEPE, create a server profile to your WebLogic 10.3.4/10.3.4 instance - and select the "Java Persistence 2.0 - Install" link on the dialog in the Eclipse IDE). However, Kodo (based on OpenJPA) is not actively developed. I would switch to EclipseLink which is the Java EE 6 reference implementation. You can do this by changing the default persistence provider in the console from Kodo to TopLink (wraps EclipseLink) or specifying the provider in your persistence.xml.
    The link you quote is the section for WebLogic 10.3.3.0
    What you need is the new section I wrote in Jan 2011 for the 10.3.4.0
    http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#20110115:_JPA_2.0_using_EclipseLink_on_WebLogic_10.3.4.0
    See my tutorials for details - where you can also see the source.
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial
    http://wiki.eclipse.org/EclipseLink/Examples/Distributed
    thank you
    Michael O'Brien
    http://www.eclipselink.org

  • How to maintain Ztable using function module instead of SM30

    Hi Friends,
    please tell me , How to maintain Ztable or view using function module instead of SM30.
    Thanks,
    Veerendra.

    Hi,
    You can design your report and use Function module VIEW_MAINTENANCE_CALL for that.
    You need to use Action type as 'S' for displaying and 'U' for maintaining the table.
    Ex:
    CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
      EXPORTING
        ACTION                               =  'S'
        VIEW_NAME                            =  'Table Name'
    EXCEPTIONS
       CLIENT_REFERENCE                     = 1
       FOREIGN_LOCK                         = 2
       INVALID_ACTION                       = 3
       NO_CLIENTINDEPENDENT_AUTH            = 4
       NO_DATABASE_FUNCTION                 = 5
       NO_EDITOR_FUNCTION                   = 6
       NO_SHOW_AUTH                         = 7
       NO_TVDIR_ENTRY                       = 8
       NO_UPD_AUTH                          = 9
       ONLY_SHOW_ALLOWED                    = 10
       SYSTEM_FAILURE                       = 11
       UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
       VIEW_NOT_FOUND                       = 13
       OTHERS                               = 14.
    Hope this helps.
    Message was edited by: Imtiaz Ahmed

  • I'd like to know how can i connect my old iMac tiger with new one iMac lion. I wanna use the old one for external disk to collect files from there to new one.

    I'd like to know how can i connect my old iMac tiger with new one iMac lion. I wanna use the old one for external disk to collect files from there to new one.

    Hi mshields1162,
    Great question, and welcome to Apple Support Communities.
    First, you may want to choose to have the sidebar displayed for familiarity:
    iTunes 11: Frequently used features
    http://support.apple.com/kb/HT5649
    Afterwards, your device should be displayed if connected:
    We'll want to click on it, and choose the Music tab at the top. Let's make sure "Sync Music" is checked:
    Afterwards, you'll have the option to sync either the entire music library (for your first iPod), or "Selected playlists, artists, albums, and genres" (for the secondary device). Upon selecting this option, four larger option boxes will appear allowing you to pick and choose what content will be synced. For audiobooks, you may need to do the above in the "Books" section. For a visual instruction on how to do this, see the following:
    iTunes 10: Sync to your iPod
    http://support.apple.com/kb/VI72
    Thanks,
    Matt M.

  • Recently no matter what I do, Firefox will not allow me to use Adobe Reader instead of it's own

    I used to be able to display pdf documents using Adobe Reader instead of Firefox's built in. I have tried everything that you suggest and that Adobe suggest. I have uninstalled and reinstalled Firefox. I have uninstalled and reinstalled Adobe Reader (11.0.09). I have gone to the options in Mozilla but when I try to change the Portable Document settings, I don't get the option for "Use Adobe Acrobat (in Firefox)". I do get the for Adobe Forms, but not for PDF documents. If I change it to use Adobe Reader, it downloads and then opens reader which is not I want. I want to use the plugin which is installed (I go to Add-ons and it is installed and "always activate").
    Help? This only started happening in the last month or so. I am running latest released Firefox (33.0.2), Windows 7 (up to date with all updates, etc.).

    That doesn't solve the problem. I have all those defaults. But in Firefox, it won't let me select for "Portable Document Format" to "Use Adobe Acrobat (in Firefox)" which it used to let me and which is what the Mozilla Firefox help stuff says to do. I can select Adobe Reader but then it downloads it and opens it in a separate reader window rather than using the plugin. If I select to let Firefox "Preview in Firefox", then the Firefox built-in PDF reader will display it. I have added an add-on "pdfViewerSwitcher" which then lets me display in the Adobe Reader plug-in but only after first displaying it in the Firefox preview. So that verifies that the Adobe Reader plug-in works. But I can't set it to always use the Adobe Reader plug-in.
    I have some reasons for wanting to use the Adobe Reader plug-in. I use Nuance Power PDF Pro for editing and doing other things with pdfs.
    This all used to work and stopped working at some point in the last couple months. And if you search the web, you will find I am not the only one with this complaint.
    I don't know whether it is Adobe's fault or Mozilla's fault but at least one of them is broken. And I think it is Firefox since it won't even let me select it but does let me select it for Adobe Forms.

  • Hi ! i have this new itunes account but when i wanna use this for apps he ask me for a card number but i don't have one .what i supposed to do ?

    Hi ! i have this new itunes account but when i wanna use this for apps he ask me for a card number but i don't have one .what i supposed to do ?

    Hi Mada7ina,
    If you are looking to set up an iTunes Store account without an associated credit card, you may find the following article helpful:
    Apple Support: Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card
    http://support.apple.com/kb/ht2534
    Regards,
    - Brenden

  • How can i use text only instead of text plus the folder icon in the bookmarks toolbar; older firefox allowed this.

    I prefer using text only instead of text plus a folder icon in the bookmarks toolbar because it used less space and I can display more bookmark folders in that toolbar. Is that possible in Firefox 4.0? It was possible in the earlier versions of Firefox. If it is possible in Firefox 4.0 how do I do that? Thank you.

    First install the "Stylish:" extension then you have thousands of styles available to choose from, most consist of only a few lines, and you can modify them to suit yourself.
    * '''Stylish''' :: Add-ons for Firefox<br>https://addons.mozilla.org/firefox/addon/stylish/
    * '''Bookmarks Toolbar Fx4 Blue/Folders, Red/Bookmarks'''<br>http://userstyles.org/styles/46947/
    * '''some styles I use:'''<br>http://kb.mozillazine.org/User:Dmcritchie

Maybe you are looking for

  • Why is there no transparent refund process displayed on the App Store?

    There does not appear to be a transparent refund process of Apps. this should be displayed visibly. Many apps may not be fit for purpose and possibly contravene the sales of goods act and advertising standards. It is perhaps time this was challenged

  • Is it possible to delete data from a block based on a view?

    I have a data block based on a view. I have set the delete allowed property to 'yes' using the object navigator, have set the database permission to allow delete, done a search through all the code to see where the delete_allowed property on the bloc

  • Release notes?

    iTunes newbie wonders if Release Notes are posted anywhere, or whether I'm just supposed to take it on faith that it's worth downloading 58MB every other time I use the software. Aside to ManfromOz: they locked that topic, preventing me from saying "

  • CD Drive keeps opening

    Hello everybody, About a few weeks ago, I got a message from the taskbar stating that my Thinkpad T400's battery can hold only 50% of its original capacity. Whenever I tried to open the CD Drive(by pressing the blue button on it only once,) a message

  • "Mini" windows (with small close/min/zoom buttons)

    I'm overall extremely pleased with Leopard. One of the things that drives me CRAZY, however, is the inconsistent nature of windows made with Get Info (⌘I). Sometimes, it seems, this creates a normal window, so that when I type the keyboard command to