File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .eight .pipeline ;
2+
3+ import java .util .List ;
4+ import java .util .stream .Collectors ;
5+ import java .util .stream .IntStream ;
6+
7+ public class GenerateNumbers {
8+
9+ public static void main (String [] args ) {
10+ //TODO generating numbers
11+ List <String > nums = IntStream .rangeClosed (1 , 9 )
12+ .mapToObj (String ::valueOf )
13+ .collect (Collectors .toList ());
14+ List <String > alphas = IntStream .rangeClosed ('A' , 'Z' )
15+ .mapToObj (i -> (char ) i )
16+ .map (String ::valueOf )
17+ .collect (Collectors .toList ());
18+
19+ System .out .println (nums );
20+ System .out .println (alphas );
21+
22+ System .out .println (
23+ alphas .stream ()
24+ .flatMap (a -> nums .stream ().map (n -> a + n ))
25+ .collect (Collectors .toList ()));
26+ }
27+
28+ public static boolean isPrime (int number ) {
29+ return IntStream .rangeClosed (2 , number / 2 )
30+ .noneMatch (iter -> number % iter == 0 );
31+ }
32+
33+ }
You can’t perform that action at this time.
0 commit comments