Collection Framework

Collection Framework

While inserting an object which sould be prefered- ArrayList or LinkedList and why?

View Answers

March 18, 2008 at 8:03 PM

Inserting an object with ArrayList

ArrayListExample.java

import java.util.*;
import java.io.*;

public class ArrayListExample{
public static void main(String[] args){
List list = new ArrayList();
list.add("Delhi");
list.add("Kanpur");
list.add("Hadrabad");
list.add("Bhagalpur");
list.add("Patna");
list.add("rose");
list.add("India");
System.out.println(list);
System.out.println("Place at 2:" + list.get(2));
System.out.println("Place at 0:" + list.get(0));

LinkedList link = new LinkedList();
link.add("Bhagalpur");
link.add("Patna");
link.add("Kanpur");
link.add("Delhi");
link.add("USA");
link.add("Patliputra");
System.out.println(link);
link.removeLast();
System.out.println(link);

}
}

March 18, 2008 at 8:05 PM

Example of inserting an object using ArrayList and LinkedList









Related Tutorials/Questions & Answers:
collection and framework.
collection and framework.  please give some study material of collection and framework
COLLECTION FRAMEWORK
COLLECTION FRAMEWORK  Hi, i need complete detailed explanation on COLLECTION FRAMEWORK with examples(which include set,list,queue,map and operations performed on them).need help... Regards, Anu
Advertisements
COLLECTION FRAMEWORK
COLLECTION FRAMEWORK  Hi, i need complete detailed explanation on COLLECTION FRAMEWORK with examples(which include set,list,queue,map and operations performed on them).need help... Regards, Anu
Collection framework
Collection framework  what are the real life examples of using Collection in java
Collection framework
Collection framework  import java.util.*; public class CollectFrame { public static void main(String [] args) { System.out.println( "Collection Example!\n" ); //int size; HashSet collection = new HashSet(); String str1
Collection Framework
Collection Framework  Please help me out..I have a class as below public class Employee { private int Id; private String name; private int salary; private int age; } public class Collection { public static void main
Collection framework tutorial
Collection framework tutorial  Hi, I am learning Collection framework in Java. I want many examples of Java collection framework. Tell me the best tutorial website for learning Java Collection framework. ThanksADS_TO_REPLACE_1
Collection Framework - Java Beginners
Collection Framework  Pls explain the disadvantages of using collection framework as it was written in this forum ? It must cast to correct type. ? Cannot do compile time checking. I couldnot get in detail as to what
Advantages and Disadvantages of the Collection Framework
Advantages and Disadvantages of the Collection Framework... will learn the advantages and disadvantages of Java Collection Framework. A collection... ordered and unordered elements.  Advantages of collections framework:ADS
Collection Framework - Java Interview Questions
Collection Framework   While inserting an object which sould be prefered- ArrayList or LinkedList and why?  Inserting an object with ArrayListArrayListExample.javaimport java.util.*;import java.io.*;public class
collection - Framework
Collection
Collection  What is the exact difference between lagacy classes and collection classes? and Enumeration is possible on Collection classes
collection
collection  As we know array holds the similar kind of elements, then in collection how toArray() method will convert the collection having different objects as elements to an array in java
collection
, Hashtable and Collections and Collection?   Enumeration : It is series... : It is re-sizable array implementation. Belongs to 'List' group in collection... Map in collection. Collections : It implements Polymorphic algorithms which
Collections Framework
to Collections Framework Collection Interfaces Set Interface Introduction...The Collections Framework provides a well-designed set of interfaces.... The collections framework is a unified architecture which is used to represent
Collection
Collection  actually why do we need collections? means we can also store group of objects in relational data base and dbms also provides all the operatoins insert,delete,update,sort,search etc. then why collection
Collections Framework
; Java provides the Collections Framework. In the Collection Framework, a collection represents the group of the objects. And a collection framework.... This framework is based on: Interfaces that categorize common collection types
Java Collection : NavigableSet Example
Java Collection : NavigableSet Example In this tutorial we are describing NavigableSet of collection Framework NavigableSet : NavigableSet interface... of NavigableSet .ADS_TO_REPLACE_3 package collection; import
Java Collection : WeakHashMap
Java Collection : WeakHashMap In this tutorial, we are going to discuss one of concept (WeakHashMap ) of Collection framework. WeakHashMap... collection; import java.util.Map; import java.util.WeakHashMap; class
Java Collection : Hashtable
Java Collection : Hashtable In this tutorial, we are going to discuss one of concept (Hashtable ) of Collection framework. Hashtable  : Hashtable... and also reorganizes internally. Example : ADS_TO_REPLACE_2 package collection
collection overview and collection interface
collection overview and collection interface  write the program for collection interface?   Please visit the following links: http://www.roseindia.net/java/jdk6/Collection-Interfaces.shtml http://www.roseindia.net
Collection Types
Collection Types  What are the Collection types in Hibernate
Framework......
Framework......  What is framework? What is difference between framework and package
Java Collection
Java Collection  What is the Collection interface
Jaca Collection
Jaca Collection  does Java collection allow incompatible types to be stored in single collection
Collection in java
Collection in java  What are the meaning of the letters E,T,K and V that come in the collection concept
Collection Api
Collection Api  which scenario we are using arraylist and linkedlist and vector
collection interface
collection interface  methods of collection interface and their description with example program?   Please visit the following links: http://www.roseindia.net/java/jdk6/Collection-Interfaces.shtml http
collection interface
collection interface  methods of collection interface and their description with example program?   Please visit the following links: http://www.roseindia.net/java/jdk6/Collection-Interfaces.shtml http
Java collection
Java collection  What are differences between Enumeration, ArrayList, Hashtable and Collections and Collection
garbage collection
garbage collection  how to use garbage collection in program using core java
Collection Api
Collection Api  what is the use of navidableset and navigablemap why we are using that two class
Garbage collection
Garbage collection  why garbage collection? How it works?   Garbage collection is one of the most important features of Java. The purpose of garbage collection is to identify and discard objects that are no longer
Collections Framework Enhancements
Collections Framework Enhancements       In Collection framework, we are able... It provides some new Collection interfaces also. Following new Interfaces
Collection HashMap
Collection HashMap  Please give me an example in which hash map having key value pair and key should be map again means map within map example. thanks in advance
Collection HashMap
Collection HashMap  Please give me an example in which hash map having key value pair and key should be map again means map within map example. thanks in advance
Difference between sorted and ordered collection in hibernate
Difference between sorted and ordered collection in hibernate  What is difference between sorted and ordered collection in hibernate?   sorted collection: A sorted collection is sorting a collection by utilizing
Java Collection API - Java Tutorials
. Collection framework is provided in 'java.util.package'. All collections... collection interface. The main benefits of Collection Framework are :ADS... Interface is the base on which the Collection framework is built. The methods
Java Collection iterator with example
The Java Collection Iterator is present at the highest level interface in the Collection framework. Iterator interface has methods for traversing, but Collection doesn't has iterator() method. So create object with reference
collection
collection
Collection
collection
collection
Iterate java collection
Collection is the top level interface of the Collection framework. Iterator interface has methods for traversing over the elements of the collection. But Collection doesn't has iterator() method. So create object
collection frame work
collection frame work  explain all the concept in collection frame work
Array to Collection
Array to Collection       In this example we are converting values of an array into collection. List  interface is a member of the Java Collection Framework
c++ garbage collection implementation
c++ garbage collection implementation  How to implement the garbage collection program in C
collection frame work
collection frame work  explain the hierarchy of one dimensional collection frame work classes
collection frame work
collection frame work  could you please tell me detail the concept of collection frame work

Ads