Here you can find the source of getStrings(Scanner sc, int n)
public static List<String> getStrings(Scanner sc, int n)
//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; } }