@@ -23,8 +23,8 @@ copy of this software and associated documentation files (the
2323*/
2424
2525package linq .testprogram ;
26- import linq .HelperFunctionsKt ;
27- import linq .collections .LinqListFunctionsKt ;
26+ import static linq .HelperFunctions . CastHelperFunctions ;
27+ import static linq .collections .LinqListFunctions . LINQ ;
2828
2929import java .util .ArrayList ;
3030
@@ -49,66 +49,66 @@ public static void main(String[] args)
4949 list3 .add (50 );
5050 list3 .add ("Hello World" );
5151 list3 .add (100 );
52- list = new ArrayList <>(LinqListFunctionsKt .Concat (list ,list2 ));
52+ list = new ArrayList <>(LINQ .Concat (list ,list2 ));
5353 try {
54- int result = LinqListFunctionsKt .First (list , (x ) -> x == 5 );
55- boolean equal = LinqListFunctionsKt .All (list ,(x ) -> x == 10 );
56- boolean hasany = LinqListFunctionsKt .HasAny (list );
57- boolean hasanyCond = LinqListFunctionsKt .HasAny (list , (x ) -> x == 12 );
58- boolean contains = LinqListFunctionsKt .Contains (list ,3 );
59- int count = LinqListFunctionsKt .Count (list );
54+ int result = LINQ .First (list , (x ) -> x == 5 );
55+ boolean equal = LINQ .All (list ,(x ) -> x == 10 );
56+ boolean hasany = LINQ .HasAny (list );
57+ boolean hasanyCond = LINQ .HasAny (list , (x ) -> x == 12 );
58+ boolean contains = LINQ .Contains (list ,3 );
59+ int count = LINQ .Count (list );
6060 System .out .println ("There are " + count + " items in the list" );
61- list2 = new ArrayList <>(LinqListFunctionsKt .Distinct (list ));
62- count = LinqListFunctionsKt .Count (list2 );
61+ list2 = new ArrayList <>(LINQ .Distinct (list ));
62+ count = LINQ .Count (list2 );
6363 System .out .println ("There are " + count + " distinct items in the list" );
64- list2 = new ArrayList <>(LinqListFunctionsKt .Intersect (list ,list2 ));
65- count = LinqListFunctionsKt .Count (list2 );
64+ list2 = new ArrayList <>(LINQ .Intersect (list ,list2 ));
65+ count = LINQ .Count (list2 );
6666 System .out .println ("There are " + count + " distinct items in both lists" );
6767 System .out .println ("First item in the list is: " + list .indexOf (result ));
6868 System .out .println ("Are All items in the list equal: " + equal );
6969 System .out .println ("Does the list contain any items: " + hasany );
7070 System .out .println ("Does the list contain any items that meet this condition: " + hasanyCond );
7171 System .out .println ("Does the list contain any items equal to 3: " + contains );
72- int average = LinqListFunctionsKt .Average (list2 );
73- int last = LinqListFunctionsKt .Last (list2 );
74- int max = LinqListFunctionsKt .Max (list2 );
75- int min = LinqListFunctionsKt .Min (list2 );
76- ArrayList <String > strings = new ArrayList <String >(HelperFunctionsKt .CastStringList (LinqListFunctionsKt .OfType (list3 )));
72+ int average = LINQ .Average (list2 );
73+ int last = LINQ .Last (list2 );
74+ int max = LINQ .Max (list2 );
75+ int min = LINQ .Min (list2 );
76+ ArrayList <String > strings = new ArrayList <String >(CastHelperFunctions .CastStringList (LINQ .OfType (list3 )));
7777 System .out .println ("The average value in the list is : " + average );
7878 System .out .println ("The Last item in the list is : " + last );
7979 System .out .println ("The Largest item in the list is : " + max );
8080 System .out .println ("The Smallest item in the list is : " + min );
8181 for (String str : strings )
8282 System .out .println (str );
83- ArrayList <Integer > range = LinqListFunctionsKt .Range (100 ,50 );
83+ ArrayList <Integer > range = LINQ .Range (100 ,50 );
8484 for (Integer num : range )
8585 System .out .print (num + "," );
8686 System .out .println ();
87- ArrayList <Integer > repeat = LinqListFunctionsKt .Repeat (100 ,10 );
87+ ArrayList <Integer > repeat = LINQ .Repeat (100 ,10 );
8888 for (Integer num : repeat )
8989 System .out .print (num + "," );
9090 System .out .println ();
91- range = new ArrayList <>(LinqListFunctionsKt .Reverse (range ));
91+ range = new ArrayList <>(LINQ .Reverse (range ));
9292 for (Integer num : range )
9393 System .out .print (num + "," );
9494 System .out .println ();
9595 try {
9696 ArrayList <Integer > single1 = new ArrayList <>();
9797 single1 .add (50 );
98- Integer item = LinqListFunctionsKt .Single (single1 );
98+ Integer item = LINQ .Single (single1 );
9999 System .out .println (item );
100100 single1 .add (100 );
101- item = LinqListFunctionsKt .Single (single1 );
101+ item = LINQ .Single (single1 );
102102 System .out .println (item );
103103 }
104104 catch (Exception e ){
105105 e .printStackTrace (System .err );
106106 }
107107 System .out .println ("After Exception" );
108108 list4 .add ("Hello" );
109- boolean string = LinqListFunctionsKt .HasAny (list4 , x -> x .equals ("Hello" ));
109+ boolean string = LINQ .HasAny (list4 , x -> x .equals ("Hello" ));
110110 System .out .println (string );
111- Integer [] array = HelperFunctionsKt .CastIntegerArray (LinqListFunctionsKt .ToArray (list2 ));
111+ Integer [] array = CastHelperFunctions .CastIntegerArray (LINQ .ToArray (list2 ));
112112 System .out .println ("Items in array" );
113113 for (Integer item : array )
114114 System .out .println (item );
0 commit comments