This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case17() { | |
ArrayList<String> users = new ArrayList<String>(Arrays.asList("Asep Dadang Supriadi", "Akmal Fuady", | |
"Yandi Fitriyanto")); | |
String usersNew = "Ricky Andika Putra"; | |
users.add(0, usersNew); | |
System.out.println(users.toString()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case16() { | |
ArrayList<String> users = new ArrayList<String>(Arrays.asList("Asep Dadang Supriadi", "Akmal Fuady", | |
"Yandi Fitriyanto")); | |
String usersNew = "Ricky Andika Putra"; | |
users.add(usersNew); | |
System.out.println(users.toString()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case11() { | |
Map<Integer, String> users = new LinkedHashMap<Integer, String>(); | |
users.put(1, "Adimas Lutfi Wicaksono"); | |
users.put(2, "Salman Alfarisi"); | |
users.put(3, "Muhammad Sholeh"); | |
users.put(4, "Yadi Cahyadi"); | |
users.put(5, "Maya Maulani"); | |
users.values(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case10() { | |
ArrayList<String> names = new ArrayList<String>(Arrays.asList("Adimas Lutfi Wicaksono", "Salman Alfarisi", | |
"Adimas Lutfi Wicaksono", "Muhammad Sholeh", "Yadi Cahyadi", "Maya Maulani", "Maya Maulani")); | |
HashSet<String> uniqueNames = new LinkedHashSet<String>(names); | |
System.out.println(uniqueNames.toString()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case9() { | |
Map<String, String> users = new LinkedHashMap<String, String>(); | |
users.put("user1@example.com", "Adimas Lutfi Wicaksono"); | |
users.put("user2@example.com", "Salman Alfarisi"); | |
users.put("user3@example.com", "Muhammad Sholeh"); | |
users.put("user4@example.com", "Yadi Cahyadi"); | |
users.put("user5@example.com", "Maya Maulani"); | |
System.out.println(users.values()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case8() { | |
Map<String, String> users = new LinkedHashMap<String, String>(); | |
users.put("user1@example.com", "Adimas Lutfi Wicaksono"); | |
users.put("user2@example.com", "Salman Alfarisi"); | |
users.put("user3@example.com", "Muhammad Sholeh"); | |
users.put("user4@example.com", "Yadi Cahyadi"); | |
users.put("user5@example.com", "Maya Maulani"); | |
users.keySet(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case7() { | |
ArrayList<String> inputOne = new ArrayList<String>(Arrays.asList("Ricky Andika Putra", "'Ramadani'", | |
"Asep Dadang Supriadi", "Akmal Fuady", "Yandi Fitriyanto")); | |
ArrayList<String> inputTwo = new ArrayList<String>(Arrays.asList("Ricky Andika Putra", "Yandi Fitriyanto", | |
"Muhammad Sholeh", "Yadi Cahyadi")); | |
ArrayList<String> results = new ArrayList<String>(); | |
for (String name: inputOne) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case6() { | |
ArrayList<String> inputOne = new ArrayList<String>(Arrays.asList("Ricky Andika Putra", "'Ramadani'", | |
"Asep Dadang Supriadi", "Akmal Fuady", "Yandi Fitriyanto")); | |
ArrayList<String> inputTwo = new ArrayList<String>(Arrays.asList("Ricky Andika Putra", "Yandi Fitriyanto", | |
"Muhammad Sholeh", "Yadi Cahyadi")); | |
ArrayList<String> results = new ArrayList<String>(); | |
for (String name: inputOne) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case5() { | |
ArrayList<String> inputOne = new ArrayList<String>(Arrays.asList("Ricky Andika Putra", "'Ramadani'", | |
"Asep Dadang Supriadi", "Akmal Fuady", "Yandi Fitriyanto")); | |
ArrayList<String> inputTwo = new ArrayList<String>(Arrays.asList("Ricky Andika Putra", "Yandi Fitriyanto", | |
"Muhammad Sholeh", "Yadi Cahyadi")); | |
ArrayList<String> results = new ArrayList<String>(inputOne); | |
for (String name: inputTwo) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void case4() { | |
ArrayList<String> users = new ArrayList<String>(Arrays.asList("Ricky Andika Putra", "Ramadani", | |
"Asep Dadang Supriadi", "Akmal Fuady", "Yandi Fitriyanto")); | |
users.remove(0); | |
} |