38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
= Java =
|
|
|
|
Java is a strongly typed, garbage collected language that runs in the JVM. It
|
|
can run on almost anything.
|
|
|
|
== Data structures ==
|
|
|
|
| C++ DS | Java DS | Notes |
|
|
| Vector | ArrayList | Threadsafe |
|
|
| Vector | Vector | Not threadsafe; deprecated |
|
|
| Deque | Deque | |
|
|
| List | ArrayList | Both linked lists |
|
|
| Map | TreeMap | Red-black tree |
|
|
| Set | TreeSet | Red-black tree |
|
|
| unordered_set | Hashset | Hashtable |
|
|
| unordered_map | Hashmap | Non blocking but race conditions can occour |
|
|
| unordered_map | Hashtable | Threadsafe but blocking; deprecated |
|
|
|
|
|
|
|
|
|
|
== Classes ==
|
|
|
|
=== Constructor ===
|
|
|
|
{{{
|
|
public class MyClass{
|
|
public MyClass(){
|
|
//constructor code here
|
|
}
|
|
|
|
|
|
}
|
|
}}}
|
|
|
|
|
|
|