Java Scanner Usage asList(String source, String separator)

Here you can find the source of asList(String source, String separator)

Description

as List

License

Open Source License

Declaration

public static List<String> asList(String source, String separator) 

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> asList(String source, String separator) {
        Scanner scanner = new Scanner(source);
        scanner.useDelimiter(separator);
        List<String> list = new ArrayList<String>();
        while (scanner.hasNext()) {
            list.add(scanner.next());/*from  www  .  java  2 s .  c  o  m*/
        }
        return list;
    }
}

Related

  1. calcCompileWarnings(String compilerResult)
  2. cleanUpEmptyLinesAndIndent(String input)
  3. close()
  4. common(Scanner in)