Immutable classes in Java

Medium Article removing setters; adding all args constructor; marking the class as final to protect it from being extended; initializing all non-primitive mutable fields via constructor by performing a deep copy; performing cloning of the returned non-primitive mutable object in getter methods; marking all class fields as final (optional step).   Now we are going to talk about immutable… Continue reading Immutable classes in Java

Advertisements

Java String

Original Blog 1) The string is immutable in Java:  String is by design immutable in Java you can check this post for a reason. Immutability offers a lot of benefit to the String class e.g. his hashcode value can be cached which makes it a faster hashmap key and one of the reasons why String is a popular… Continue reading Java String

Round-robin DNS

Wiki Round-robin DNS is a technique of load distribution, load balancing, or fault-tolerance provisioning multiple, redundant Internet Protocol service hosts, e.g., Web server, FTP servers, by managing the Domain Name System's (DNS) responses to address requests from client computers according to an appropriate statistical model. In its simplest implementation, Round-robin DNS works by responding to DNS requests not only with a single potential IP address, but… Continue reading Round-robin DNS