Collection, List,Set and Array List In Java - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Thursday, 14 November 2013

Collection, List,Set and Array List In Java

A collection represents a group of objects, known as its elements. Some collections allow duplicate elements and others do not.

It provides implementations of more specific sub interfaces like Set and List.

The List interface extends Collection and declares the behavior of a collection that stores a sequence of elements.
Elements can be inserted or accessed by their position in the list, using a zero-based index.
A list may contain duplicate elements.


A Set is a Collection that cannot contain duplicate elements.

Array List supports dynamic arrays that can grow as needed.

Standard Java arrays are of a fixed length. After arrays are created, they cannot grow or shrink, which means that you must know in advance how many elements an array will hold.

Array lists are created with an initial size. When this size is exceeded, the collection is automatically enlarged. When objects are removed, the array may be shrunk. 

hasNext() method Returns true if this scanner has another token in its input.  
It returns Boolean values true and false

next() method finds and returns the next complete token from this scanner 

Declaration
Following is the declaration for java.util.Scanner.next() method
public String next()

No comments:

Post a Comment