anoterCode
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 11s
Gitea Actions Demo / GoBuild (push) Failing after 5s

This commit is contained in:
2024-09-11 23:21:31 -04:00
parent 922420d5e2
commit c5974fe278
10 changed files with 196 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class Collectionz {
public static void main(String[] args) {
// ArrayList
ArrayList<Integer> arr = new ArrayList<>();
arr.add(45);
arr.add(63);
arr.add(24);
arr.add(65);
arr.add(74);
arr.add(22);
arr.add(3, 100);
System.out.println(arr);
Collections.sort(arr);
System.out.println(arr);
System.out.println(arr.contains(43));
// Hashset
HashSet<String> hs = new HashSet<>();
hs.add("Sami");
hs.add("Leena");
hs.add("Zakaria");
hs.add("Mohammed");
hs.add("Sara");
hs.add("Chekalil");
hs.add("Benmoulay");
hs.add("doctor");
hs.add("Engineer");
System.out.println(hs);
Iterator<String> it = hs.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}
System.out.println("");
System.out.println("");
System.out.println("");
// HashMap
//
HashMap<Integer, String> hm = new HashMap<>();
hm.put(0, "Zakaria");
hm.put(1, "Sara");
hm.put(2, "Leena");
hm.put(3, "Sami");
System.out.println(hm);
Set sm = hm.entrySet();
Iterator it2 = sm.iterator();
while (it2.hasNext()) {
System.out.println(it2.next());
}
}
}