Update for 30-03-22 12:15
This commit is contained in:
parent
655e235e62
commit
6f79c61ae4
@ -5,17 +5,20 @@ 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 |
|
||||
|
||||
| C++ DS | Java DS | Notes |
|
||||
| Vector | ArrayList | Threadsafe |
|
||||
| Vector | Vector | Not threadsafe; deprecated |
|
||||
| Deque | Deque | |
|
||||
| Stack | Stack | Stack implementation using a vector |
|
||||
| List | ArrayList | Both linked lists; Singly linked |
|
||||
| List | LinkedList | Doubly linked list |
|
||||
| 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 |
|
||||
| N/A | LinkedHashMap | LRUCache; Hash table that knows order of elements inserted/accessed |
|
||||
| N/A | LinkedHashSet | LRUCache; Hash set that knows order of elements inserted/accessed |
|
||||
|
||||
|
||||
|
||||
@ -28,10 +31,25 @@ can run on almost anything.
|
||||
public MyClass(){
|
||||
//constructor code here
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}}}
|
||||
|
||||
=== Deconstructor/Finalize ===
|
||||
|
||||
finalize provides security and is called by the garbage collector. We can call
|
||||
it directly to clean up the object. All exceptions thrown by it are ignored by
|
||||
the garbage collector.
|
||||
|
||||
{{{
|
||||
public class MyClass{
|
||||
public MyClass(){
|
||||
//constructor code here
|
||||
}
|
||||
|
||||
protected void finalize(){
|
||||
//clean up code here
|
||||
}
|
||||
}
|
||||
}}}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user