Reversing a string using Stack Implementation

In our previous post, we saw how to create a custom stack implementation in java. Today we are going to extend the same implementation to perform additional operations like reversing, checking empty or full etc. Approach 1: [Simple & Best Approach]   We have used the same Stack class from this post </a> with small modification like array type changed from int […]

 1,251 total views,  2 views today

» Read more

Property binding angular 4/5/6 example

Property binding angular 4 example: What is property binding ? Binding html properties like disabled[disabled], class[ngClass] and style[ngStyle] dynamically with component values using angular. You can even create your own custom property using @Input. Syntax: [] Eg: [disabled]   Property binding Types: Element property Component property Directive property In our last tutorial we have seen about event binding and twoway […]

 2,455 total views,  6 views today

» Read more

Array sorting in Java using Comparator Interface

Array sorting in Java using Comparator Interface Array can be sorted in ascending and descending order using, Arrays.sort() method. By Implementing Comparator interface. Find the example array sorting programs below. With Comparator Interface Array sorting Example: Java File with integer array and Called ArrayReverseOrder and ArrayAscendingOrder using Comparator implemented classes to perform descending and ascending array sorting respectively. package […]

 1,811 total views

» Read more

Converting String Array to Integer Array Example Java

Java Program to Convert String Array to Integer Array: In this below program we have converted string array to integer array. package in.javadomain; public class StringArrayToIntArray { public static void main(String[] args) { String[] strArray = { "10", "20", "30", "40", "50" }; int[] intArray = new int[strArray.length]; for (int i = 0; i < strArray.length; i++) { intArray[i] = […]

 1,581 total views

» Read more

Converting Array to Arraylist in Java Example

Array to ArrayList: package in.javadomain; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class ArrayTOArrayList { public static void main(String[] args) { String[] languagesArray = { "Tamil", "English", "Hindi", "Telugu" }; List<String> langArrayList = new ArrayList<String>(); Collections.addAll(langArrayList, languagesArray); for (Object value : langArrayList) { System.out.println("Value in ArrayList :::" + value); } } } Output: [plain] Value in ArrayList :::Tamil Value in […]

 1,104 total views,  4 views today

» Read more

ArrayList to Array in Java Example

ArrayList to Array: The below program converts ArrayList to Array. Java Program: package in.javadomain; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ArrayListTOArray { public static void main(String[] args) { List<String> mobilesList = new ArrayList<String>(); mobilesList.add("Nokia"); mobilesList.add("Karbonn"); mobilesList.add("Micromax"); mobilesList.add("Samsung"); Object[] listToObj = mobilesList.toArray(); String[] mobilesArray = Arrays.copyOf(listToObj, listToObj.length, String[].class); System.out.println("Value in Array is ::: " + mobilesArray[2]); } } Output: […]

 1,016 total views,  4 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 […]

 1,295 total views

» 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 […]

 1,048 total views,  4 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 […]

 1,348 total views,  2 views today

» Read more
1 2 3