Java Scanner Usage getStrings(Scanner sc, int n)

Here you can find the source of getStrings(Scanner sc, int n)

Description

get Strings

License

Open Source License

Declaration

public static List<String> getStrings(Scanner sc, int n) 

Method Source Code


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

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static List<String> getStrings(Scanner sc, int n) {

        List<String> result = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            result.add(sc.nextLine());/*w ww.j  a v  a  2s.c  o  m*/
        }
        return result;
    }
}

Related

  1. getOutputFromValgrindOutput(String valgrindOutput)
  2. getPartOfString(String string, int index, String delimiter)
  3. getReplay(String prompt)
  4. getScannerContents(final Scanner scanner)
  5. getStrings(Properties props, String key, String sep)
  6. getTimeAsInt(String duration)
  7. getTypedValue(String question)
  8. input(String message)
  9. input(String prompt)