We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f7be2e commit 1e0f603Copy full SHA for 1e0f603
Finding Extreme Values
@@ -0,0 +1,20 @@
1
+import java.util.Collections;
2
+import java.util.ArrayList;
3
+
4
+class Main {
5
+ public static void main(String[] args) {
6
+ // Creating an ArrayList
7
+ ArrayList<Integer> numbers = new ArrayList<>();
8
+ numbers.add(1);
9
+ numbers.add(2);
10
+ numbers.add(3);
11
12
+ // Using min()
13
+ int min = Collections.min(numbers);
14
+ System.out.println("Minimum Element: " + min);
15
16
+ // Using max()
17
+ int max = Collections.max(numbers);
18
+ System.out.println("Maximum Element: " + max);
19
+ }
20
+}
0 commit comments