File tree Expand file tree Collapse file tree 3 files changed +67
-0
lines changed
sources/net.sf.j2s.java.core/src/test Expand file tree Collapse file tree 3 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ package test ;
2+
3+ import java .util .stream .Collectors ;
4+ import java .util .stream .DoubleStream ;
5+ import java .util .stream .IntStream ;
6+
7+ public class Test_Java8a extends Test_ {
8+
9+ String test = "testing" ;
10+
11+ public int getI (int i ) {
12+ return test .charAt (i );
13+ }
14+
15+ public double [] getTest () {
16+ return IntStream .range (0 , 4 ).mapToDouble (i -> this .getI (i )).toArray ();
17+ }
18+
19+ private static String whitespaceString (int width ) {
20+ return IntStream .range (0 , width ).mapToObj (i -> " " ).collect (Collectors .joining ());
21+ }
22+
23+ public static void main (String [] args ) {
24+ double [] cc = new Test_Java8a ().getTest ();
25+ assert (cc [2 ] == 's' );
26+ double [] dd = new Test_Java8a ().values ().toArray ();
27+ assert (dd [2 ] == 2 );
28+ assert (whitespaceString (10 ).length () == 10 );
29+ System .out .println ("Test_Java8a OK" );
30+ }
31+
32+ public DoubleStream values () {
33+ return IntStream .range (0 , 4 )
34+ .mapToDouble (this ::get );
35+ }
36+
37+
38+ public double get (int row ) {
39+ return row ;
40+ }
41+
42+ }
Original file line number Diff line number Diff line change 1+ package test ;
2+
3+ public class Test_inta implements Test_inta1 {
4+
5+ // note that Integer does not work to implement Number.
6+ public String testInt (Integer i ) {
7+ // TODO Auto-generated method stub
8+ return null ;
9+ }
10+
11+ @ Override
12+ public String testInt (Number n ) {
13+ // TODO Auto-generated method stub
14+ return null ;
15+ }
16+
17+
18+ }
Original file line number Diff line number Diff line change 1+ package test ;
2+
3+ public interface Test_inta1 {
4+
5+ public String testInt (Number n );
6+
7+ }
You can’t perform that action at this time.
0 commit comments