Command-Line Arguments in Java
I think you have already noticed the unusual header for the main method in Java, which has the parameter args of String[] type. Obviously, args is an array of String. The main…
I think you have already noticed the unusual header for the main method in Java, which has the parameter args of String[] type. Obviously, args is an array of String. The main…
Overview Binary Search is a commonly used search algorithm in programming. Let's see how we implement it by using the Java programming language. For binary search to work, we need…
The linear search approach compares the key element key sequentially with each element in the array. It continues to do so until the key matches an element in the array,…
RESTful API Authentication Method Generally speaking, RESTful API get Authentication and Authorization to make sure the safety of the API. Authentication vs Authorization Authentication means the identity of the user…
概述 String 对于日常代码来说是一个使用频率很高的对象,因为它的一些使用数据和基本数据类型有些相似,所以很容易把String 混淆为基本数据类型。 public final class String implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage. */ private final char value[]; /** Cache the hash…
Comparable and Comparator in Java are very useful for sorting collection of objects. Java provides some inbuilt methods to sort primitive types array or Wrapper classes array or list. Here…
A queue is a first-in, first-out data structure. Elements are appended to the end of the queue and are removed from the beginning of the queue. In a priority queue,…
Java HashMap is HashTable based implementation of Map. This is the reason why interviewer always asks for the difference between HashMap and HashTable. HashMap is mostly equaled to HashTable except…
HashSet The HashSet class implements the Set interface, backed by a hash table which is actually a HashMap instance. No guarantee is made as to the iteration order of the…
Java TreeSet Introduction TreeSet is one of the most important implementations of the SortedSet interface in Java that uses a Tree for storage. The ordering of the elements is maintained…