# Others ## Java ### Set > https://www.geeksforgeeks.org/set-in-java/ Unordered collection of objects in which duplicate values cannot be stored. ```java import java.util.*; public class SetExample{ public static void main(String[] args) { // Set demonstration using HashSet Set<String> hash_Set = new HashSet<String>(); hash_Set.add("Geeks"); hash_Set.add("For"); hash_Set.add("Geeks"); hash_Set.add("Example"); hash_Set.add("Set"); System.out.println(hash_Set); } } // output: [Set, Example, Geeks, For] ``` The set interface allows the users to perform the basic mathematical operation on the set. Lets take two arrays to understand these basic operations. Let *set1 = [1, 3, 2, 4, 8, 9, 0] set2 = [1, 3, 7, 5, 4, 0, 7, 5].* Then the possible operations on the sets are: 1. Intersection (*addAll*): This operation returns all the common elements from the given two sets. For the above two sets, the intersection would be: ```Intersection = [0, 1, 3, 4]``` 2. Union (*retainAll*): This operation adds all the elements in one set with the other. For the above two sets, the union would be: ```Union = [0, 1, 2, 3, 4, 5, 7, 8, 9]``` 3. Difference (*removeAll*): This operation removes all the values present in one set from the other set. For the above two sets, the difference would be: ```Difference = [2, 8, 9]``` ### Map > https://www.geeksforgeeks.org/map-interface-java-examples/ The Map interface present in java.util package represents a mapping between a key and a value. ```java import java.util.*; class HashMapDemo { public static void main(String args[]) { Map<String, Integer> hm = new HashMap<String, Integer>(); hm.put("a", new Integer(100)); hm.put("b", new Integer(200)); hm.put("c", new Integer(300)); hm.put("d", new Integer(400)); // Traversing through the map for (Map.Entry<String, Integer> me : hm.entrySet()) { System.out.print(me.getKey() + ":"); System.out.println(me.getValue()); } } } // output: // a:100 // b:200 // c:300 // d:400 ``` ### Callback ## TCP / IP~ > https://www.freecodecamp.org/news/what-is-tcp-ip-layers-and-protocols-explained/ The most widely used protocol in ==Internet/Network layer== is **IP**. IP is **connectionless** ( it provides no guarantee that packets are sent or received in the right order, along the same path, or even in their entirety). Reliability is handled by other protocols in the suite, such as in the transport layer. The ==Transport Layer== presently encapsulates **TCP** and **UDP**. Like IP, UDP is **connectionless** and can be used to prioritize time over reliability. TCP, on the other hand, is a **connection-oriented** transport layer protocol that prioritizes reliability over latency, or time. TCP describes transferring data in the same order as it was sent, retransmitting lost packets, and controls affecting the rate of data transmission. > https://www.guru99.com/tcp-ip-model.html