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 ==
|
== Data structures ==
|
||||||
|
|
||||||
| C++ DS | Java DS | Notes |
|
| C++ DS | Java DS | Notes |
|
||||||
| Vector | ArrayList | Threadsafe |
|
| Vector | ArrayList | Threadsafe |
|
||||||
| Vector | Vector | Not threadsafe; deprecated |
|
| Vector | Vector | Not threadsafe; deprecated |
|
||||||
| Deque | Deque | |
|
| Deque | Deque | |
|
||||||
| List | ArrayList | Both linked lists |
|
| Stack | Stack | Stack implementation using a vector |
|
||||||
| Map | TreeMap | Red-black tree |
|
| List | ArrayList | Both linked lists; Singly linked |
|
||||||
| Set | TreeSet | Red-black tree |
|
| List | LinkedList | Doubly linked list |
|
||||||
| unordered_set | Hashset | Hashtable |
|
| Map | TreeMap | Red-black tree |
|
||||||
| unordered_map | Hashmap | Non blocking but race conditions can occour |
|
| Set | TreeSet | Red-black tree |
|
||||||
| unordered_map | Hashtable | Threadsafe but blocking; deprecated |
|
| 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(){
|
public MyClass(){
|
||||||
//constructor code here
|
//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