How to iterate Linkedhashmap in Java

LinkedHashMap: Values will be stored as key value pair as like in HashMap. Order of iteration is same as order of insertion. (In HashMap order will not be guaranteed) Allows one null key and many null values. Duplicates are not allowed and if only the key is duplicate then the value of the respective key will be overridden. Iterating LinkedHashMap: […]

462 total views, no views today

» Read more

Difference between Hashmap and Linkedhashmap in Java

HashMap and LinkedHashMap: HashMap: Order will not be guaranteed. Allows one null key and many null values. It will not allow the duplicates, if only the key is duplicate then value be overridden. LinkedHashMap: Order of iteration will be same as order of insertion. (insertion order) Allows one null key and many null values as like HashMap. It will not […]

922 total views, no views today

» Read more

Transient in Java with example

What is Transient ? Transient is a keyword used to prevent object from serialization. what is serialization ? Serialization is nothing but storing the object states. Is transient applicable for variable, method and class ? No. transient can be used only for instance variable and It can not be used for, Local variables Methods and Classes. Transient Example program: package […]

382 total views, no views today

» Read more

How to hide tags in wordpress ?

I know that, your wordpress site look getting destroyed due to tags. Here is the way which you can try. This way working fine for Admired theme. Please try this way, if it works fine then enjoy, else find the solution online and kindly paste the code in comments so that others can enjoy….!!! Steps: 1. Go to Appearance 2. […]

484 total views, no views today

» Read more

Difference between concat and append in Java

Difference between concat and append in java: concat(): String has concat method, remember string is immutable. It adds a string to another string. It will create the new object after concatenation done, since it is a immutable. append(): StringBuilder and StringBuffer has append method, remember these two are mutable. It appends a char or char sequence to a string. It […]

5,896 total views, no views today

» Read more

Difference between concat and + in java

Difference between + and concat(): Using + operator: 1. Any type of variable can be concatenated, it is not mandatory to be a string variable. String firstVar = "Java"; int secVar = 11; String plusConcat = firstVar + secVar; System.out.println(plusConcat); // prints Java11 2. String can be null and it will not throw null pointer exception. String myVar = null; […]

468 total views, no views today

» Read more

String Concatenation in Java

String Concatenation in Java: String Concatenation in Java can be possible by two ways, Using + operator. Using Concat() Function. Example Program: package com.javadomain.in; public class StringConcatenation { public static void main(String[] args) { String hVariable = "hello "; String wVariable = "world"; String hwVariable = hVariable.concat(wVariable); String a = "java"; String b = "domain"; String javadomain = a + […]

432 total views, no views today

» Read more

Array vs Arraylist java

Array vs ArrayList java: Array: 1. Size must be defined during initialization itself. 2. Size can not be resized once initialized. int[] myArraySize = new int[10]; //Possible int[] myArray = new int[];  // Not possible 3. Size of the array calculated using length. int[] myArr = new int[9];System.out.println("size of the array : "+myArr.length); //prints 9 4. Both objects and primitives […]

498 total views, no views today

» Read more

Array of ArrayList in Java example

Array of ArrayList: Array of ArrayList has to be typecasted first. ArrayList array has to be initialized first with ArrayList. Then we have to add the values to the ArrayList. Iterator has to be created separately for each arraylist of array. Program: import java.util.ArrayList; import java.util.Iterator; public class ArrayofArrayList { public static void main(String[] args) { ArrayList[] myArrayArrayList = (ArrayList[])new […]

409 total views, no views today

» Read more

Int array vs Integer array in java

Int array vs Integer array in java: Both int array and integer array is same in terms of holding the value/assigning the value. But int[] array can store only primitive data types, where as Integer[] array can store objects also. Also only Integer[] array can store “null”.   Int Array: Int array to store primitive data type (int) values. but now […]

478 total views, no views today

» Read more
1 2 3