Welcome to www.qatutorials.com!!!!
      
      
Question Answer Tutorial Search
Home Search Add Question JAVA Core JAVA Multi Threading

Collection

JDBC SWING SERVLET JSP Advance Java Other Struts
Hibernate Mock Test Contact Feedback
Home
Search
Add Question
JAVA
Core JAVA
Multi Threading

Collection

JDBC
SWING
SERVLET
JSP
Advance Java Other
Struts
Hibernate
Mock Test
Subscribe/Unsubscribe
Email:
Social Media
Facebook

Misc Tutorials

References

Question and Answer Tutorial
Tutorials Point
Stack Overflow

Question Answer Tutorial - JAVA->Collection

First Previous 1 2 3 4 5 6 Next Last
                        
Question: What is Collection?
Answer: Collection is a framework which is used to put a g
roup of objects togather.
Question: What is Collections in Java?
Answer: Collections in java is a framework that provides an arc
hitecture to store and manipulate the group/>of objects. All the operations that you perform on a&
nbsp;data such as searching, sorting, insertion,/>manipulation, deletion etc. can be performed by Java Colle
ctions. Java Collection simply means a/>single unit of objects. Java Collection framework provides 
;many interfaces (Set, List, Queue, Deque/>etc.) and classes (ArrayList, Vector, LinkedList, PriorityQueue,&nbs
p;HashSet, LinkedHashSet, TreeSetetc).
Question: What is the Hierarchy of Collection Framework?
Answer: The hierarchy of collection framework is as follows:/>##ImageTag##CollectionHierarchy_QATutorials.JPG##Collection Framework Hierarchy
/>/>/>/>/>/>/>/>/>/>
/>/>/>/>
Question: What are the important methods in Collection Interface?
Answer: There are many methods declared in the Collection interface.
 They importatnt methods are asfollows:/>
No.Method Description
1 public boolean add(Object element)It is used to&n
bsp;insert an element in thiscollection
2 public boolean addAll(collection c)It is used to&
nbsp;insert the specified collection/>elements in the invoking collection
3 public boolean remove(Object element)It is used t
o delete an element from thiscollection
4 public boolean removeAll(Collection c)It is used 
to delete all the elements of/>specified collection from the invoking collection
5 public boolean retainAll(Collection c)It is used 
to delete all the elements of/>invoking collection except the specified collection
6 public int size()It return the total number 
of elements in thecollection
7 public void clear()It removes the total no o
f element from thecollection
8 public boolean contains(object element)It is used 
;to search an element
9 public boolean containsAll(Collection c)It is used&nbs
p;to search the specified/>collection in this collection
10 public Iterator iterator()It returns an iterator
11 public Object[] toArray()It converts collection into&
nbsp;array
12 public boolean isEmpty()It checks if collection 
is empty
13 public boolean equals(Object element)It matches two&n
bsp;collection
14 public int hashCode()It returns the hashcode num
ber forcollection

Question: What is Iterator interface?
Answer: Iterator interface provides the facility of iterating the el
ements in forward direction only
                        
First Previous 1 2 3 4 5 6 Next Last
Comment:
Name:Email:
Contact No.:
Copyright © 2014 by SBJ Group. All Rights Reserved. Developed and maintained by SBJ Group. Supported on Internet Explorer browser only