fastreader in java

Solutions on MaxInterview for fastreader in java by the best coders in the world

showing results for - "fastreader in java"
Hanae
09 Jun 2018
1static class FastReader {
2
3        BufferedReader br;
4        StringTokenizer st;
5
6        public FastReader() {
7            br = new BufferedReader(new InputStreamReader(System.in));
8        }
9
10        String next() {
11            while (st == null || !st.hasMoreElements()) {
12                try {
13                    st = new StringTokenizer(br.readLine());
14                } catch (IOException e) {
15                    e.printStackTrace();
16                }
17            }
18            return st.nextToken();
19        }
20
21        int nextInt() {
22            return Integer.parseInt(next());
23        }
24
25        long nextLong() {
26            return Long.parseLong(next());
27        }
28
29        double nextDouble() {
30            return Double.parseDouble(next());
31        }
32
33        String nextLine() {
34            String str = "";
35            try {
36                str = br.readLine();
37            } catch (IOException e) {
38                e.printStackTrace();
39            }
40            return str;
41        }
42    }
queries leading to this page
fastreader in javafastreader in java