java中的hash是否有一定的顺序和规律呢

来源:百度知道 编辑:UC知道 时间:2024/05/24 23:56:01
在作题时感觉前10个是有顺序的,但多了就好象没有了,但看上去却很有规律,哪个高手可以讲解下呀...本人初学
import java.util.Enumeration;
import java.util.Properties;

public class TestPropnew {

/**
* @param args
*/
public static void main(String[] args) {
Properties prop = new Properties();

for (int i = 0; i < 31; i++) {//当这该到i<10时输出就有规律了,是到着输出的但写大了就没顺序了
prop.put(i + "", i + "");

}
System.out.println(prop);

Enumeration er = prop.propertyNames();
while (er.hasMoreElements()) {
String key = (String) er.nextElement();
String value = prop.getProperty(key);
System.out.println(key += "=" + value);

}

}
}
本人初学,希望各位高手能帮帮忙

具体可以参考一下hash算法~~,这样了解会甚深。

hash表中的数据都是按hash值来排序的,以加快访问其中数据的速度

hash算法,简单说就是均匀分布。无顺序,有索引。