Collection of Large Number of Java Sample Programs and Tutorials

Collection of Large Number of Java Sample Programs and Tutorials Collection of Large Number of Java Sample Programs and Tutorials HelloWorld Java Program Simple Java Program for beginners that prints HelloWorld! on console.

Collection of Large Number of Java Sample Programs and Tutorials

Java Collection Examples

Java 6.0 New Features (Collection Framework)
As the name indicates
collections is a group of objects known as its elements. Basically it is a package of data structures that includes ArrayLists, LinkedLists, HashSets, etc. A collection is simply an object that groups multiple elements into a single unit. It is also called as a container sometimes. It is used to store, retrieve, manipulate, and communicate aggregate data. 

  1. Introduction to Collections API
    A collection is simply an object that groups multiple elements into a single unit. It is also called as a container sometimes. It is used to store, retrieve, manipulate, and communicate aggregate data.
      

  2. Advantages and Disadvantages of collection Framework
    In this section, you will read the advantages and disadvantages of Java Collection Framework. 
     

  3. Java 6.0 Collection Framework
    Some of the new collections APIs have been introduced in Java 6.0.
      

  4. Collections Framework Enhancement
    In Collection framework, we are able to improve the performance hashing function that is used by java.util.HashMap. It provides some new Collection interfaces also.

Lets See How to Work With Collections Framework With the Help of Following Examples.

  1. Navigable Map Example
    In NavigableMap we use methods to return the key value pair like navMap.put(1, "January"); whereas in NavigableSet we use methods to return values.
      

  2. Navigable Set Example
    In the example below we have used NavigableSet method to sort the elements in ascending order, descending order, also to retrieve the element which is immediately greater than or equal to 35 etc. 
     

  3. HashSet Example
    In this section provides you an example to HashSet collection frame work.
    A HashSet is a set that doesn't allow duplicate elements and doesn't order or position its elements.
      

  4. Linked List Example
    This section discusses an example to demonstrate the various methods of List interface. We are using two classes ArrayList and LinkedList in the example code.
     

  5. Tree Map Example
    In the following example, we have used the TreeMap method, which stores its elements in a tree and orders its elements based on their values. Here in the example we have used the key of the element to show the values of the element.
     

  6. Tree Set Example
    In the following example, we have used the TreeSet collection, which is similar to TreeMap that stores its elements in a tree and maintain order of its elements based on their values.
     

  7. What is Collection Framework?
    Java provides the Collections Framework. In the Collection Framework, a collection represents the group of the objects. And a collection framework is the unified architecture that represent and manipulate collections.
        
  8. Iterate Collection
    In this Example you will learn you will learn how to iterate collection in java. A running example of java program is provided that shows you how you can iterate collections in java.
      
  9. Converting a Collection to an Array
    Here is the illustration for the conversion from the collection to an array. In this section, you will learn how to do this.
      
  10. Converting an Array to a Collection
    Here is the illustration for the conversion from the an array to a collection. In this section, you will learn how how to do this. The given example gives you a brief introduction for converting an array to collection without losing any data or element held by the array.
        
  11. Implementing a Queue
    In this section, you will learn how to implement the queue. A queue holds a collection of data or elements and follows the FIFO ( First In First Out) rule.
        
  12. Implementing a Stack
    In this section, you will learn how to implement a stack in Java. A Stack is like a bucket in which you can put elements one-by-one in sequence and retrieve elements from the bucket according to the sequence of the last entered element.
  13. Map.Entry Java Interface
    Sometimes you need to work with map entry. This can be done using Map.Entry Interface of Java.   
Ads