@@ -155,7 +155,7 @@ void for_each_loop() {
155155 void file_write () {
156156 String line_to_write = "Append to end of file" ; // VER: file_write
157157 try { // VER: file_write
158- BufferedWriter file = new BufferedWriter (new FileWriter ("out.txt" , true )); // VER: file_write
158+ BufferedWriter file = new BufferedWriter (new FileWriter ("out.txt" ,true )); // VER: file_write
159159 file .write (line_to_write ); // VER: file_write
160160 file .close (); // VER: file_write
161161 } // VER: file_write
@@ -232,7 +232,7 @@ <T> T[] joinArrays(T[] a, T[] b) {
232232 }
233233
234234 void define_list () {
235- List <String > cc = new ArrayList <>(Arrays .asList (new String []{"a" , "b" , "c" })); // VER: define_list
235+ List <String > cc = new ArrayList <>(Arrays .asList (new String []{"a" ,"b" ,"c" })); // VER: define_list
236236 System .out .println (String .join ("," , cc )); // VER: define_list
237237 System .out .println (cc .get (0 )); // VER: define_list
238238 String last = cc .remove (cc .size ()-1 );
@@ -286,7 +286,8 @@ void split_strings() {
286286
287287 void list_comprehension () {
288288 // int[] i = new int[]{1,2,3,4}; Arrays.stream(i).collect(toList());
289- List <Integer > data1 = new ArrayList <>(Arrays .asList (new Integer []{1 ,2 ,3 ,4 ,5 ,6 })); // VER: list_comprehension
289+ List <Integer > data1 = new ArrayList <>(Arrays .asList ( // VER: list_comprehension
290+ new Integer []{1 ,2 ,3 ,4 ,5 ,6 })); // VER: list_comprehension
290291 List <Integer > data2 = data1 .stream () // VER: list_comprehension
291292 .filter ((i ) -> i >= 3 ) // VER: list_comprehension
292293 .map ((i ) -> i * 2 ) // VER: list_comprehension
@@ -321,9 +322,9 @@ void define_2d_arrays() {
321322 record Point (Integer x , Integer y ) {} // VER: define_2d_arrays_with_1d_array_with_lookup_function
322323 record Dimension (Integer w , Integer h ) { // VER: define_2d_arrays_with_1d_array_with_lookup_function
323324 Integer size () {return w () * h ();} // VER: define_2d_arrays_with_1d_array_with_lookup_function
324- Integer coord_to_index (Point p ) {return coord_to_index (p .x (), p .y ());} // VER: define_2d_arrays_with_1d_array_with_lookup_function
325- Integer coord_to_index (Integer x , Integer y ) {return (y * w ()) + ( x % w ());} // VER: define_2d_arrays_with_1d_array_with_lookup_function
326- Point index_to_coord (Integer i ) {return new Point (i % w (), i / w ());} // VER: define_2d_arrays_with_1d_array_with_lookup_function
325+ Integer coord_to_index (Point p ) {return coord_to_index (p .x (),p .y ());} // VER: define_2d_arrays_with_1d_array_with_lookup_function
326+ Integer coord_to_index (Integer x , Integer y ) {return (y * w ())+( x % w ());} // VER: define_2d_arrays_with_1d_array_with_lookup_function
327+ Point index_to_coord (Integer i ) {return new Point (i % w (),i / w ());} // VER: define_2d_arrays_with_1d_array_with_lookup_function
327328 } // VER: define_2d_arrays_with_1d_array_with_lookup_function
328329 // VER: define_2d_arrays_with_1d_array_with_lookup_function
329330 Dimension d = new Dimension (width , height ); // VER: define_2d_arrays_with_1d_array_with_lookup_function
0 commit comments