Replace character in string
String result = yourString.replaceAll("&", "&");
Convert the string to a char array
char[] charArray = originalString.toCharArray();
Get character a index n
char c = str.charAt(n)
Get a substring from a string
Creating a hastable
Hashtable<String, Integer> hashtable = new Hashtable<>()
Adding values to a hastable
hashtable.put("One", 1);
Retrieving values from hastable
int value = hashtable.get("Two");
Removing a key-value pair
hashtable.remove("Three");
Checking if a key is inside hastable
hashtable.containsKey(keyToCheck)
Creating a list
List<String> myList = List.of("A", "B", "C", "D", "E", "F", "G");
Creating a sublist from index i to n (n not included)
List<String> subList = myList.subList(i, n);
Get value at index n
myList.get(n)
Create a set
import java.util.HashSet;
import java.util.Set;
Set<String> stringSet = new HashSet<>();
Add to a set
stringSet.add("Apple");
Check if set contains an element
stringSet.contains("Banana");
Remove element from set
stringSet.remove("Orange");