Java Scanner Usage loadStringDoubleMap(Scanner scanner)

Here you can find the source of loadStringDoubleMap(Scanner scanner)

Description

load String Double Map

License

Open Source License

Declaration

public static HashMap<String, double[]> loadStringDoubleMap(Scanner scanner) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.HashMap;

import java.util.Scanner;

public class Main {
    public static HashMap<String, double[]> loadStringDoubleMap(Scanner scanner) {
        HashMap<String, double[]> ret = new HashMap<String, double[]>();
        int dimX = scanner.nextInt();
        int dimY = scanner.nextInt();
        scanner.nextLine();//from  w  w  w. ja v a 2s.  c  o  m
        for (int i = 0; i < dimX; i++) {
            String word = scanner.nextLine();
            double[] vals = new double[dimY];
            for (int j = 0; j < dimY; j++) {
                vals[j] = scanner.nextDouble();
            }
            scanner.nextLine();
            ret.put(word, vals);
        }
        return ret;

    }
}

Related

  1. leerOpcion(String opciones, String msgUsr, String msgErr)
  2. leerTexto(String msgUsr)
  3. listify(String s, String prefix, String... ignorelist)
  4. listify(String s, String prefix, String... ignorelist)
  5. loadElements(Scanner scan, int elementCount, int skipCount)
  6. menu()
  7. nextChar(Scanner s)
  8. nextInt(final Scanner sc)
  9. numberOfLines(String text)