com.eaio.uuid.UUID.compareTo()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中com.eaio.uuid.UUID.compareTo()方法的一些代码示例,展示了UUID.compareTo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID.compareTo()方法的具体详情如下:
包路径:com.eaio.uuid.UUID
类名称:UUID
方法名:compareTo

UUID.compareTo介绍

[英]Compares this UUID to another Object. Throws a ClassCastException if the other Object is not an instance of the UUID class. Returns a value smaller than zero if the other UUID is "larger" than this UUID and a value larger than zero if the other UUID is "smaller" than this UUID.
[中]将此UUID与另一个对象进行比较。如果另一个对象不是UUID类的实例,则引发ClassCastException。如果另一个UUID比此UUID“大”,则返回小于零的值;如果另一个UUID比此UUID“小”,则返回大于零的值。

代码示例

代码示例来源:origin: stephenc/eaio-uuid

/**
 * Compares two Objects for equality.
 *
 * @see java.lang.Object#equals(Object)
 * @param obj the Object to compare this UUID with, may be <code>null</code>
 * @return <code>true</code> if the other Object is equal to this UUID,
 * <code>false</code> if not
 */
@Override
public boolean equals(Object obj) {
  if (!(obj instanceof UUID)) {
    return false;
  }
  return compareTo((UUID) obj) == 0;
}

代码示例来源:origin: se.scalablesolutions.akka/akka-actor

/**
 * Compares two Objects for equality.
 *
 * @see java.lang.Object#equals(Object)
 * @param obj the Object to compare this UUID with, may be <code>null</code>
 * @return <code>true</code> if the other Object is equal to this UUID,
 * <code>false</code> if not
 */
@Override
public boolean equals(Object obj) {
  if (!(obj instanceof UUID)) {
    return false;
  }
  return compareTo((UUID) obj) == 0;
}

相关文章