Posts

Java LinkedList class in Collection

Image
Java LinkedList class in Collection --  LinkedList class uses doubly linked list to store the elements and data. It provide a linked-list data structure.get free coins thetechieking --  It inherits the AbstractList class and implements List and Deque interfaces in java. --  LinkedList class is non synchronized. --  LinkedList class follow insertion order.  --  LinkedList class can allow duplicate elements to store data. --  manipulation is faster than ArrayList because no shifting needs. Declaration of LinkedList class in java : -- public class LinkedList<E> extends AbstractSequentialList<E>    implements List<E>, Deque<E>, Cloneable, Serializable   Constructors of Java LinkedList :  LinkedList()   LinkedList(Collection c) Methods of LinkedList class : 1) boolean add ( Object element ) : -- It appends the element to the end of the list. 2) void add ( int index, Object element ) : -- It inserts the element at the position

Java ArrayList class in collections

Image
Java ArrayList class in collections --  ArrayList class uses a dynamic array for storing the elements. It inherits AbstractList class and implements List interface in java.  --  ArrayList class can allows random access because array works at  the index basis.  --  ArrayList is non synchronized class in java. --  ArrayList class maintains insertion order to data --  ArrayList can contain duplicate elements. --  manipulation is slow in ArrayList class because a lot of shifting      needs to operation with data.   ArrayList class have three Constructor.    1) ArrayList ( )   2) ArrayList ( Collection c )   3) ArrayList ( int capacity )    Some Methods of  ArrayList class   1) void add ( int index, Object element )    -   insert the specified element at the specified position index in a list.   2) boolean addAll ( Collection c )    -  used to append all of the elements in the specified collection to the       end of this

Collections in Java

Image
Collections in Java   --        The Java Collections Framework is a collection of interfaces and classes which helps in storing and processing the data efficiently.   --  Collections in Java are used in almost every application. --  Java Collections Framework is one of the core part of Java --  Collections provides an architecture to   store and manipulate the group of objects and data. --  A Collection is a group of individual objects represented as a single unit Advantages of Java Collections Framework Collections framework have following benefits: 1)  We need not to learn multiple ad hoc collection APIs in java 2)  Reduced Development Effort 3)  Increased Quality  4)  It provides standard interface for collections that fosters software reuse and also provides algorithms to manipulate data. 5) collection can grow and resizable Collection chart  Classes and interface in collections.   List interface

Constructors in Java

Image
Constructors in Java. -- A constructor is a special method of function  that is used to   initialize an object in java. --  every class has a constructor by default. --  compiler build a default constructor for that class. --  constructor are executed at time of object creation of class.  --  there are no return type in java constructor --  An interface cannot have the constructor in java. --  Constructors cannot be private modifire. --  Constructors name must be similar to that of the class name.   There are 2 type of constructor in Java :     1) Default Constructor.  2) Parameterized constructor.     1) Default Constructor. --  A java constructor that has no parameter is known as default constructor. thats build by compiler. --  if we write a constructor with parameter or non-parameter then compiler does not create default constructor. example of default constructor : class JavaConstructor {        JavaConstructo

Array in Java

Image
Array in Java             Array is a collection of similar type of elements that have contiguous memory location.Java array is an object the contains elements of same datatype. it is a data structure where we store similar elements. We can store only fixed set of elements in a java array. Arrays in Java are homogeneous data structures implemented in Java as objects Advantage of Java Array     : 1) Code Optimization : It makes the code optimized, we can retrieve or sort the data easily. 2) Random access       : We can get any data located at any index position     Disadvantage of Java Array : 1) Size Limit : We can store only fixed size of elements in the array. It doesn't grow its size at runtime. To solve this problem, collection framework is used in java.   There are two types of array. Single Dimensional Array Multidimensional Array   1) Single Dimensional Array    //declaration and instantiation       int  array[]= new   in

String in Java

Image
String in Java                      S tring is a sequence of characters. But in Java, a string is an object that represents a sequence of characters. There are two ways to create a String object: 1)String literal : Java String literal is created by  using double quotes.   For Example: String str= “ Hello String ” ; 2)new keyword : Java String is created by using a keyword “new”. For example:  String str= new String( “ Hello String ” );   It will creates two objects in String pool and in heap and one reference variable where the variable ‘str’ will refer to the object in the heap. String's Methods.   1) String length() : The Java String length() method tells the length of the string. It returns count of total number of characters present in the String . example :          String str= "nirav patel on java" ; System.out.println(str.length());     2) String concat() : The Java String concat() metho

Spring Boot Features In Java

Image
Spring Boot Features Spring Application Web Development Admin features Application events and listeners Externalized Configuration Properties Files YAML Support Type-safe Configuration Security Logging and many more... ⇒ Spring Application           spring application is a class which provides the convenient way to bootstrap a spring application which can be started from main method. You can call start your application just by calling a static run() method. ⇒Web Development         It is well suited Spring module for web application development. We can easily create a self-contained HTTP server using embedded Tomcat, Jetty or Undertow. We can use the spring-boot- starter-web module to start and running applications quickly. ⇒Admin Support      Spring Boot provides the facility to enable admin related features for the application. It is used to access and manage application remotely. We can enable it by simply using sprin