Java Charset.hashCode()
Syntax
Charset.hashCode() has the following syntax.
public final int hashCode()
Example
In the following code shows how to use Charset.hashCode() method.
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map;
//from w w w.j a v a 2 s. co m
public class Main {
public static void main(String[] args) {
Map<String, Charset> charsets = Charset.availableCharsets();
Iterator<Charset> iterator = charsets.values().iterator();
while (iterator.hasNext()) {
Charset cs = (Charset) iterator.next();
System.out.println(cs.displayName());
System.out.println(cs.hashCode());
}
}
}
The code above generates the following result.