Java Util Examples List part-I (data structures in java)
The util package or java provides many utility interfaces and classes for easy manipulation of in-memory data. The java util package tutorials at RoseIndia.net introduces you with the Java util package of JDK. All the examples are with free source code. It includes many examples that demonstrate the syntax and example code of java util package.
1. What is java.util package?
Java Utility package is one of the most used packages in the java programming world and package provides many interfaces and classes for easy manipulation of data.
2. Generating a Random Number
In many places you need random numbers to fulfill your requirements. Java provides classes to help you in generation random numbers for your application.
3. Breaking a String into Words
. The java.util.*; package provides you a simple method to breaking the string into separate words.
4. Listing All Available Locales
Locale is the class of java.util.*; package. This class represents the geographical, political and cultural region. Every tasks which requires to perform the operation is called local-sensitive.
5. Setting the Default Locale
this package tells how to set the default locale. Example presented in the section, illustrates you how to get and set the default locale.
6. Associating a Value with an Object
This tells how to associate value with an object in Java util. Here, you will know how to associate the value for the separate code. Values regarding to the separate code are maintained as a record of the specific person.
7. Comparing Arrays
This tells show you how to determine the given arrays are same or not. The given program illustrates you how to compare arrays according to the content of the that.
8. Shuffling the Elements of a List or Array
Shuffling is the technique i.e. used to randomize the list or array to prepare each and every element for the operation.
9. 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.
10. Iterate Collection
In this Example 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.
11. Java next()
In this section, you will get the detailed explanation about the next() method of interface Iterator. We are going to use next() method of interface Iterator in Java.
12. Java remove()
This tells about how to get the detailed explanation about the remove() method of interface Iterator. We are going to use remove() method of interface Iterator in Java.
13. Java nextElement()
This tells how to get the detailed explanation about the nextElement() method of interface Enumeration. We are going to use nextElement() method of interface Enumeration in Java.
14. Java hasMoreElement()
In this section, you will get the detailed explanation about the hasMoreElement() method of interface Enumeration. We are going to use hasMoreElement() method of interface Enumeration in Java.
15. Converting a Collection to an Array
Here is the illustration for the conversion from the collection to an array.
16. 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.
17. Collection to Array
The example given below illustrates the conversion of a collection into a array. In this example we creating an object of ArrayList, adding elements into this object and storing this object into List interface. Convert elements of ArrayList into an array by using toArray().
18. 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.
19. 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.
20. Implementing a Least-Recently-Used (LRU) Cache
In this section, you will learn about the least-recently- used(LRU) cache in Java. LRU Cache helps you how to use the buffer and how to limit or fixed the size of buffer and how to manage storing and retrieving process of the buffer which size is limited.
Leave a Reply
You must be logged in to post a comment.