بِسْمِ اللّهِ الرَّحْمَنِ الرَّحِيْمِ
اللهم صل على محمد وآل محمد
اللهم صل على محمد وآل محمد
السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُه

Question :
Codes :
import java.util.*;
public class Soalan1 {
public static ArrayList<Integer> removeDuplicates(List<Integer> inputList){
ArrayList<Integer> newList =new ArrayList<Integer>();
for(Integer element : inputList) {
if(!newList.contains(element)) {
newList.add(element);
}
}
return newList;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
List<Integer> InputList = new ArrayList<Integer>();
Scanner sc = new Scanner(System.in);
for(int i=0; i<10; i++) {
InputList.add(sc.nextInt());
}
ArrayList<Integer> newList = removeDuplicates(InputList);
Collections.sort(newList);
System.out.print(newList.size() + ": ");
Iterator<Integer> it = newList.iterator();
while(it.hasNext()) {
System.out.print(it.next() + " "); }
sc.close();
}
}
Jangan Lupa Follow Saya Untuk Updates Terkini. Moga bermanfaat.
👉 Join Telegram Channel : https://t.me/mohdnoorshawal
👉 Instagram : https://www.instagram.com/mohdnoorshawal
👉 TikTok : https://tiktok.com/@mohdnoorshawal
👉 Subscribe Youtube : https://www.youtube.com/c/mohdnoorshawall
👉 Twitter : https://twitter.com/mohdnoorshawal
👉 Website : http://www.mohdnoorshawal.com
اللهم صل على محمد وآل محمد
(Allahumma salli 'ala Muhammad wa ali Muhammad)
سُبْحَانَ اللّهِ وَ بِحَمْدِهِ ، سُبْحَانَ اللّهِ الْعَظِيمِ(SubhanAllahi wa biHamdihi, SubhanAllahil adzim)
سبحانك اللهم وبحمدك أشهد ان لا إله إلا أنت أستغفرك وآتوب إليك
(Subhanakallahumma wabihamdika asyhadu allaailaaha illa anta astaghfiruka wa atuubu ilaika)

0 Comments