Operation | Code |
---|---|
New List |
List<Integer> x = new ArrayList<Integer>(); |
Copy List |
List<Integer> x = new ArrayList<Integer>(y); |
Add an element to the List |
x.add(element) |
Get an elemenet from the List |
x.get(index) |
Clear the list | x.clear() |
New HashMap |
HashMap<Integer, String> x = new HashMap<Integer, String>(); |
Add element to the map | x.put(key, value) |
Get an element from the map | x.get(key) |
Declare a class | public class Ideone extends Main implements Runnable { ... } |
Declare a function | public static List<String> weave(String a1, String a2) |
Append to a StringBuilder |
StringBuilder b = new StringBuilder();b.append(...); |
Prepend to a StringBuilder |
b.insert(0, "text"); |
Get a substring from a string | str.substring(i, j) |
Last active
January 19, 2017 09:52
-
-
Save icyflame/05a63ee40246add5c2ac81fd3762b61f to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment