Javatime-instant-hashcode

提供:Dev Guides
移動先:案内検索

java.time.Instant.hashCode()メソッドの例

説明

  • java.time.Instant.hashCode()*メソッドは、このインスタントのハッシュコードを返します。

宣言

以下は* java.time.Instant.hashCode()*メソッドの宣言です。

public int hashCode()

戻り値

適切なハッシュコード。

次の例は、java.time.Instant.hashCode()メソッドの使用方法を示しています。

package com.finddevguides;

import java.time.Instant;

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

      Instant instant = Instant.now();
      System.out.println(instant.hashCode());
   }
}

上記のプログラムをコンパイルして実行すると、次の結果が生成されます-

1226468241