java.util.UUID.compareTo(UUID val) 方法示例


java.util.UUID.compareTo(UUID val) 方法示例

package com.codingdict;

import java.util.*;

public class UUIDDemo {
   public static void main(String[] args) {

      // creating UUIDs      
      UUID u1 = UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d");
      UUID u2 = UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d");

      // comparing uuids
      System.out.println("Comparing two UUIDs: "+u1.compareTo(u2));    
   }    
}