Author: Vijay Karnam

GIT Bash frequently used commands- Cheat sheet

GIT Bash frequently used commands- Cheat sheet

Java
Below are some of the common git bash commands, the most frequently used ones are in italic fonts Scratch- create a new local repository - $ git init {project_name} Download from existing repo - $ git clone my_appliction_url List new or modified files not committed - $ git status show the changes to files not staged/committed - $ git diff Show all the staged and unstaged file changes - $ git diff HEAD Show the changes between two commit ids - $ git commit1 commit2 List the change dates and authors for a file - $ git blame {file} Show the file changes for a commit id and file - $ sit show [commitId]:[file] Show full change history - $ git log Show the change history for file including diffs - $ git log -p [file] List all local branches - $ git branch list all branches,local and ...

Arraylist to Array Using ToArray() in java

Articles, Java
Syntax: <T> T[] toArray(T[] a) Eg : String[] y = x.toArray(new String[0]); T - the runtime type of the array to contain the collection Parameters: a - the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose. Returns: an array containing the elements of this list Throws: ArrayStoreException - if the runtime type of the specified array is not a supertype of the runtime type of every element in this list NullPointerException - if the specified array is null Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. Size of Array created is eq

hashMap Vs TreeMap Vs LinkedHashMap

Java, Quiz
════════════╦═════════════════════╦═══════════════════╦═════════════════════╗ ║ Property ║ HashMap ║ TreeMap ║ LinkedHashMap ║ ╠══════════════╬═════════════════════╬═══════════════════╬═════════════════════╣ ║ Iteration ║ no guarantee order ║ sorted according ║ ║ ║ Order ║ will remain constant║ to the natural ║ insertion-order ║ ║ ║ over time ║ ordering ║ ║ ╠══════════════╬═════════════════════╬═══════════════════╬═════════════════════╣ ║ Get/put ║ ║ ║ ║ ║ remove ║ O(1) ║ O(log(n)) ║ O(1) ║ ║ containsKey ║ ║ ║