Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC Collection framework
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rahul Dubey
Collection framework
1 Answer(s)      a year and 11 months ago
Posted in : JDBC


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 = "Y", str2 = "W", str3 = "G", str4 = "B"; //Iterator iterator;

collection.add(str1); collection.add(str2); collection.add(str3); collection.add(str4); System.out.println("Collection data: "+str1," "+str2," "+str3," "+str4); thanks


Advertisement
View Answers

November 22, 2012 at 4:17 PM


Here is an example of HashSet example.

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 = "Y",str2 = "W", str3 = "G", str4 = "B"; 
        //Iterator iterator;

        collection.add(str1); 
        collection.add(str2);
        collection.add(str3);
        collection.add(str4);
        Iterator itr = collection.iterator();

    System.out.println("HashSet contains : ");
    while(itr.hasNext())
      System.out.println(itr.next());
  }
}


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. Thanks   Hi
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
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
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
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
, 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
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... collection; import java.util.Iterator; import java.util.NavigableSet; import
Java Collection : WeakHashMap
Java Collection : WeakHashMap In this tutorial, we are going to discuss one of concept (WeakHashMap ) of Collection framework. WeakHashMap... if key is presented. Example : package collection; import java.util.Map
Framework......
Framework......  What is framework? What is difference between framework and package
Java Collection : Hashtable
Java Collection : Hashtable In this tutorial, we are going to discuss one of concept (Hashtable ) of Collection framework. Hashtable  : Hashtable... internally. Example : package collection; import
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
Collections Framework Enhancements
Collections Framework Enhancements       In Collection framework, we are able... It provides some new Collection interfaces also. Following new Interfaces
Java Collection
Java Collection  What is the Collection interface
Collection in java
Collection in java  What are the meaning of the letters E,T,K and V that come in the collection concept
Jaca Collection
Jaca Collection  does Java collection allow incompatible types to be stored in single collection
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
Collection Api
Collection Api  what is the use of navidableset and navigablemap why we are using that two class
Advertisements
 

 

 

DMCA.com