What do you want to save?
Add Code snippet
New code examples
-
Java 2022-02-11 11:35:21
java foreach list
ArrayList<String> namesList = new ArrayList<String>(Arrays.asList( "alex", "brian", "charles") ); for(String name : namesList) { Syste... Add solution -
-
Other 2022-02-03 11:36:54
maximum number from Array
---without sort method--- public static int maxValue( int[] n ) { int max = Integer.MIN_VALUE; for(int each: n) if(each > max) max = each; return max; ---with sort method--- public static int maxValue( int[] n ) { Arrays.sort( n ); return... Add solution -
Java 2022-02-02 12:10:52
java overloading
Overloading mean same method name and different parameter, it can happen in same class. it's a feature that allows us to have more than one method with same name. Example: sort method of Arrays class Arrays.sort(int[] arr) Arrays.sort(String[] arr) ...... Add solution -
Other 2022-02-02 04:47:50
int[] -> Integer[] or List<Integer>
int[] data = {1,2,3,4,5,6,7,8,9,10}; // To boxed array Integer[] what = Arrays.stream( data ).boxed().toArray( Integer[]::new ); Integer[] ever = IntStream.of( data ).boxed().toArray( Integer[]::new ); // To boxed list List<Integer> you = Arrays.... Add solution -
Javascript 2022-02-01 12:06:57
8.3.1. Common Array Methods // sort Examples (.sort)
//The general syntax for this method is: arrayName.sort() /*This method arranges the elements of an array into increasing order. For strings, this means alphabetical order. HOWEVER, the results are not always what we expect.*/ let letters = ['f', 'c',... Add solution