How to get keep one column as a key and the other columns as a array list

Hello,
I am really new to Java...I am trying to read a text file containing different columns separated by comma and then create a hash map for the first column (key) and then rest as a array list for the key.I am not able to create the hash map and the corresponding key.Could someone help me in this regard.
The text document is :
AcctNo,AcctMngr,AcctType,ProdList,Volume,AcctPrice,Returns
12345,Vikram,2,MSFS:IBM:XYZ:MAN,28000,4500,1.25
53278,Anand,1,PLYS:AIX:YET:WON,85000,8500,2.32
94005,Vincent,3,UTIL:FLY:YEL:WIN,67000,5600,3.21
45000,Abhishek,2,WENS:KYL:MEN:ABS,34000,9800,4.21
76000,Chris,3,MENS:IBM:ROC:QUE,25000,2500,2.15
67000,Kiran,4,FORS:ITI:MOC:REM,32000,3500,1.54
87000,Rohit,2,MSNF:IIT:HOT:ROC,54000,5400,4,23
45600,Sathyan,3,HELP:FOR:PRO:GRA,65000,3400,2,1.98
84600,Vinay,4,PLZE:TES:ROC:WEN,76000,7300,3,4.32
65000,Venkat,2,HETT:WEL:SEE:RED,89000,9800,1,3.23
and the code which i have so far is
import java.io.*;
import java.util.*;
class SearchHash {
public static void main (String args[]) {
int i=0;
int j=0;
Object newKey = new Object();
Object newValue = new Object();
Map map1 = new HashMap();
ArrayList a1 = new ArrayList();
String val;
try {
BufferedReader br1 = new BufferedReader ( new FileReader ( new File ("progress.txt")));
String s="";
s = br1.readLine();
while (s!=null) {
StringTokenizer st = new StringTokenizer (s ,",");
int k=0;
while (st.hasMoreTokens()) {
while (k<=6) {
val= st.nextToken();
if (k==0) {
newKey = val;
else{
newValue = val;
a1.add(newValue);
k = k+ 1;
map1.put(newKey,a1);
map1.put(newKey,a1);
a1.clear();
s = br1.readLine();
// System.out.println(map1);
}catch (Exception e) {
System.out.println("Exception Raised : " + e);
Thanks.,...

Array? Don't live in object denial. Define a class (Account?) and parse each line as an Account object. Then you put them into a Map<Integer, Account> by their account number.

Similar Messages

  • How can i keep one email box separate from all the others....?

    I have 4-5 personal email accounts. Mail gets them all, and it works as i want it - with ALL my inboxes and sent mail aggregated.
    However, i now want to add my business exchange account. I want this totally separate - not mixed in with personal.
    Ideally i'd like to run two instances of mail - is that possible?
    If not, i'd like a completely separate set of mailboxes (in, sent, drafts, etc) for exchange mail.
    Can thsi be done? How?
    thanks.
    Grant

    At some point i just sigh and continue to use OAW, bad as it is.
    What is the problem with the suggestion I gave you?
    IO rally want to figure out a way to trick the system into letting me run two instances, or keeping the two accounts independent.
    Even if you could trick the system into running two copies of Mail, what do you think that would accomplish? They would both try to access the same Mail settings and data files. If the workarounds posted here aren't sufficient, you will just have to use a different mail client.
    'Tis a shame there is no true outlook for MacOS.....yet.
    LOL, that's like saying it's a shame you can't walk into a restaurant and order a plate of dog poo...

  • I have dragged 2 files to the trash bin but I cannot delete them from the trash bin. It keeps telling me these files are in use when they are not. How do I delete these files? One is a txt file and the other is an xls file

    I have dragged 2 files to the trash bin but I cannot delete them from the trash bin. It keeps telling me these files are in use when they are not. How do I delete these files? One is a txt file and the other is an xls file

    From the Finder menu select 'Secure Empty Trash'. If this or the suggestion above doesn't resolve the problem take a look at the various suggestions in this link:
    http://www.thexlab.com/faqs/trash.html

  • How should I do if I paid monthly payment twice for a month. One is by Auto payment and the other is by hand... Is it possible to get refund? don't I need to pay for it next time?

    How should I do if I paid monthly payment twice for a month. One is by Auto payment and the other is by hand... Is it possible to get refund? don't I need to pay for it next time?

    I know a couple others that waited for two billing cycles but it will come back as a credit on that account.

  • I have 2 apple id's. But i want my music on iTunes common on both id's. I use one ID on my iPad and the other on my family iMac.  how do i do it?

    I have 2 apple id's. But i want my music on iTunes common on both id's. I use one ID on my iPad and the other on my family iMac.  how do i do it?

    Settings>Store...tap the ID shown...sign out...now sign back in with the ID you want to use.

  • How often syncs Firefox sync with the server were my bookmarks are storaged? Can I turn of the historical sync because one computer is at home and the other is at work. So I use totally different webpages and would like to have the history disabled.

    How often syncs Firefox sync with the server were my bookmarks are storaged? Can I turn of the historical sync because one computer is at home and the other is at work. So I use totally different webpages and would like to have the history disabled.

    OK, I found the part about history. It is just to unmark that.
    But still i wonder how often it sync? Instantly? Or when closing FF?

  • Just installed Firefox 9.0.1. When opening a new browser session, two tabs will open. One is my home page and the other is a Firefox welcome page. I just want my homepage to open. How do I achieve this? Thanks.

    Just installed Firefox 9.0.1. When opening a new browser session, two tabs will open. One is my home page and the other is a Firefox welcome page. I just want my homepage to open. How do I achieve this? Thanks.

    See these articles for some suggestions:
    *https://support.mozilla.org/kb/Firefox+has+just+updated+tab+shows+each+time+you+start+Firefox
    *https://support.mozilla.org/kb/How+to+set+the+home+page - Firefox supports multiple home pages separated by '|' symbols
    *http://kb.mozillazine.org/Preferences_not_saved

  • I have a 3 year old MacBook Pro with MAC OSX 10.6.8, iPhoto '09 version 8.1.2 and have downloaded two software programs: one is Aperture 3.2 and the other is Photoshop Elements 9 (which I got from a friend who didn't need it). I am totally happy with the

    I have a 3 year old MacBook Pro with MAC OSX 10.6.8, iPhoto ’09 version 8.1.2 and have downloaded two software programs: one is Aperture 3.2 and the other is Photoshop Elements 9 (which I got from a friend who didn’t need it).
    I am totally happy with the way iPhoto organizes my photos and how I can work with iMovie to create slide shows with music from iTunes, etc.
    I have been shooting mostly high resolution jpegs and I continue to learn more and more about photography, post processing etc. I realize that the small adjustments I can make in iPhoto are good, and are adequate most of the time. However, a have started to experiment with shooting RAW images and would like to go the next step, ie. post processing.I am totally technically challenged and need SIMPLE, INTUITIVE programs and am certainly NOT anywhere ready for Photoshop CS whatever!
    After having these programs sit on my computer, I decided to try to see if I could figure them out. When I opened Aperture, this is what first comes up.
    “Welcome to Aperture 3.2
    Your library needs to be upgraded to work with this version of Aperture. Once upgraded, you will not be able to use this library with previous versions of Aperture.
    Upgrading a library from previous versions of Aperture 3 generally takes a few minutes or less, though larger libraries will take longer. After that, Aperture 3.2 will upgrade your library's thumbnails, but you can use the application during that time.
    Tip: To open a different library, quit Aperture and hold the Option key down while starting Aperture
    Current Library Location:
    Jadzia (home)   -----Pictures------Aperture Library
                                                      QUIT             UPGRADE”
    I have heard horror stories  about moving your entire library to Aperture, ending up with 2 libraries, etc. etc. hence my previous reluctance in attempting Aperture. In addition, many of my photography friends are saying: Go with Lightroom 3.....you’ll love it!
    So here is my dilemma.  I don’t want to mess around with my iPhoto library. All I want to be able to do, is to isolate a few photos, export them to Aperture, Elements, and work on them there, then bring them back into iPhoto.
    Can I do this? Should I forget about Aperture and Elements and look at purchasing yet another program like Lightroom?

    Export those few photos via the File ➙ Export ➙ File Export menu option with Kind = Original to the Desktop.  Then import them into the Aperture library. That would keep one copy in your iPhoto library and another in your Aperture library to edit, etc.
    You can use Photoshop Elements 9 from within iPhoto as your editor of choice. However, if you edit a raw file in iPhoto with PSE9 the resulting edited version must be saved outside the iPhoto Library and imported back in as a new file.  For editing jpegs just do a Save (not a Save As) and it all will be kept within iPhoto. 
    Using Photoshop or Photoshop Elements as Your Editor of Choice in iPhoto.
    1 - select Photoshop or Photoshop Elememts as your editor of choice in iPhoto's General Preference Section's under the "Edit photo:" menu.
    2 - double click on the thumbnail in iPhoto to open it in Photoshop.  When you're finished editing click on the Save button. If you immediately get the JPEG Options window make your selection (Baseline standard seems to be the most compatible jpeg format) and click on the OK button. Your done. 
    3 - however, if you get the navigation window
    that indicates that  PS wants to save it as a PS formatted file.  You'll need to either select JPEG from the menu and save (top image) or click on the desktop in the Navigation window (bottom image) and save it to the desktop for importing as a new photo.
    This method will let iPhoto know that the photo has been editied and will update the thumbnail file to reflect the edit..
    NOTE: With Photoshop Elements  the Saving File preferences should be configured as shown:
    I also suggest the Maximize PSD File Compatabilty be set to Always.  In PSE’s General preference pane set the Color Picker to Apple as shown:
    Note:  to switch between iPhoto and PS or PSE as the editor of choice Control (right)-click on the thumbnail and select either Edit in iPhoto or Edit in External Editor from the contextual menu. If you use iPhoto to edit more than PSE re-select iPhoto in the iPhoto General preference pane. Then iPhoto will be the default editor and you can use the contextual menu to select PSE for your editor when desired.
    OT

  • TS3899 I have set up two email accounts on my iphone4, one with tiscali, my ISP, and the other on gmail. I am able to receive emails on both accounts, and can send emails from my gmail account, but am "Unable to Send Email" from my tiscali (talktalk) acco

    I have set up two email accounts on my iphone4, one with tiscali, my ISP, and the other on gmail. I am able to receive emails on both accounts, and can send emails from my gmail account, but am "Unable to Send Email" from my tiscali (talktalk) account. I get the error message "A copy has been placed in your Outbox. The sender address "name"@tiscali.co.uk was rejected by the server".

    Hi apmichael,
    If you are having issues sending email from one of your mail accounts on your iPhone, you may find the following article helpful:
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    Regards,
    - Brenden

  • Hi! when starting my computer the background went gray with two hard drives in the middle. One is named macintosh HD and the other recovery 10.9. I have my whole life on my computer, and i don't know which of them i should start up? Please i need help!

    Hey!
    when starting my computer the screen is gray with two harddrives. One is named Macintosh HD and the other Recovery 10.9. My computer has never done this before! I am really worrid that my files will be lost if i choose to start the wrong harddrive. Which one should i choose? HELP!!

    You probably held down the Option or Command R keys when you heard the startup tone. Simply choose the HD. To learn what the Recovery partition is please read OS X: About OS X Recovery

  • I have just purchased the new macbook pro 15" and see that it comes with 2 discs in the box, one being Mac OS X and the other being Applications Install DVD. Are these pre installed? or do I need to insert the discs and install them?

    I have just purchased the new macbook pro 15" and see that it comes with 2 discs in the box, one being Mac OS X and the other being Applications Install DVD. Are these pre installed? or do I need to insert the discs and install them?

    All has been installed. Those are there in case you need to do a reinstall. Unlike most Windows based hardware vendors these days. Apple still ships software you might need in case a drive fails. Even in the case of the new MacBook Air, Apple ships the software on a flash drive.

  • Is face time between Apple devices free if one person is in France and the other person is in the U.S.?

    IS face time free between two persons if one person is in France and the other person is in the U.S.?  One is on an iPad Mimi and the other an apple laptop or iPad.

    It uses the internet. If either person has wi-fi it can be done on that, otherwise it will use cellular data count against one or both persons cellular data plan.

  • I have two iMac's one running 10.6.8 and the other 10.8.2  What Apeture program should I purchase?

    I have two iMac's one running 10.6.8 and the other 10.8.2  What Apeture program should I purchase?

    You can currently only buy the current version Aperture 3.4.3 at the AppStore, and that version requires MacOS X 10.7.5. at least, see the release notes: Aperture 3.4.3
    So you will not be able to install this version on your Snow leopard machine. Maybe you can buy a boxed retail version of an earlier release, compatible with Snow Leopard, but the newer version is faster and compatible with iCloud.
    Do your iMacs both have the same processors and memory? You will wan to use your fastest mac with the best graphics card and the most RAM to run Aperture, also a large screen would be desirable.
    Regards
    Léonie

  • To transfer contents of one MBP to another do they both have to have the same version of the OS? I have one which is SL (source) and the other is ML (target) .. thanks

    To transfer contents of one MBP to another do they both have to have the same version of the OS? I have one which is SL (source) and the other is ML (target) .. thanks

    No, they can be running different versions of OS X, but beware that any old PowerPC apps will not run with Mountain Lion.

  • I have an iMac, iPad 2 and one child has an iTouch and the other an iPhone 4S.  How do we get separate facetimes?

    Hello, I have an iMac and an iPad 2.  one of my kids have an iTouch and the other an iPhone 4S. 
    When their friends call, it shows up on my iPad 2 and the list of friends is the list of friends for my child
    who has the iPhone 4S.    To my knowledge, we all have to share an APPLE ID to share music and apps?...
    So is that the problem....what happens if we have separate APPLE ID's....?
    Even though we are an APple fam, I am still not sure how the whole thing works....
    How do we get separate facetimes?  Thank you so much in advance.  

    Actually you can have separate apple ID's for icloud and facetime but use the family one for purchases so you can share your apps, music..
    Each owner opens up a Apple ID for only their device(s).. Log into icloud using new apple ID on each device for each person. Hit facetime in settings, and input your new apple id as facetime ID.. Done..
    Now go to settings > store and make sure your family account is inputed there on all the devices so you can share your purcahsed music, apps, videos, etc....
    I am sharing purcahses with my entire family but we all have separate icloud, facetime, apple ID etc.. Its imperative you have split Apple ID's for icloud otherwise all your phonebooks will mix and match.....
    Also as far as iphone goes.. Iphone can be set up to use apple ID to call or phonenumber (by default) So if you facetime a number it will ring only on that phone, if you facetime an apple ID that is on the iphone it will ring on all devices associated with that apple ID

Maybe you are looking for

  • Camera in not found after Yosemite upgrade.

    2012 Macbook Pro Things we have already tried. (Several times) First - find out if the computer recognizes the camera. Check System Profiler (in the Utilities folder, inside the Applications folder). Under the USB header, check to see if the iSight c

  • Safari 1.3.2 suddenly started crashing on iMac G5 OS 10.3.9

    I do most of my work on a MacBook Pro but have kept an old iMac G5 for occasional use when I want a large screen and it has worked well for some years. Having not used it for some time, when I tried yesterday Safari kept crashing. My home page is Goo

  • Downgrading from Final Cut Pro HD to Final Cut Express 4

    I have Final Cut Pro HD I have chosen to go back to (or to) Final Cut Express 4. I just bought the upgrade version of FCE 4 and I am wondering if FCP HD counts as a former version of FC for the upgrade version. I haven't opened the box so I want to m

  • Where can I find the Acrobat Pro 9 download for Mac?

    It is not available under the download older versions section of the website. Windows is, not Mac.

  • Time machine questions.  Please help

    So,  I'm getting rid of my laptop and switching.    I've had my time machine external HD plugged into my airport extreme doing backups.   Well,  I just plugged it into the laptop directly and hit backup   So is it really just as simple as plugging th