Introduction
The java.util.UUID class represents an immutable universally unique identifier (UUID).Following are the important points about UUID:- A UUID represents a 128-bit value.
- It is used for for creating random file names, session id in web application, transaction id etc.
- There are four different basic types of UUIDs: time-based, DCE security, name-based, and randomly generated UUIDs.
Class declaration
Following is the declaration for java.util.UUID class:public final class UUID extends Object implements Serializable, Comparable<UUID>
Class constructors
S.N. | Constructor & Description |
---|---|
1 | UUID(long mostSigBits, long leastSigBits) This constructor constructs a new UUID using the specified data. |
Class methods
S.N. | Method & Description |
---|---|
1 | int clockSequence() This method shows the clock sequence value associated with this UUID. |
2 | int compareTo(UUID val) This method compares this UUID with the specified UUID. |
3 | boolean equals(Object obj) This method compares this object to the specified object. |
4 | static UUID fromString(String name) This method creates a UUID from the string standard representation. |
5 | long getLeastSignificantBits() This method returns the least significant 64 bits of this UUID's 128 bit value. |
6 | long getMostSignificantBits() This method returns the most significant 64 bits of this UUID's 128 bit value. |
7 | int hashCode() This method returns a hash code for this UUID. |
8 | static UUID nameUUIDFromBytes(byte[] name) Static factory to retrieve a type 3(name based) UUID based on the specified byte array. |
9 | long node() This method returns the node value associated with this UUID. |
10 | static UUID randomUUID() Static factory to retrieve a type 4(pseudo randomly generated) UUID. |
11 | long timestamp() This method returns the timestamp value associated with this UUID. |
12 | String toString() This method returns the String object representing this UUID. |
13 | int variant() This method returns the variant number associated with this UUID. |
14 | int version() This method removes the version number associated with this UUID. |
Methods inherited
This class inherits methods from the following classes:- java.util.Object
No comments:
Post a Comment