java ssdb 操作link遍历map的两种方式

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dreamzuora/article/details/84967761

方法一:不推荐使用,只会返回map中的key

Link link = ssdb.link;
resp = link.request("qpush", "q", "a");

for(int i=1; i<resp.raw.size(); i+=2){
String s = new String(resp.raw.get(i));
System.out.println(s);
}

方法二:

		Response resp = link.request("hgetall", "中国");
		resp.buildMap();
		Map<byte[], byte[]> map = resp.items;
		Set<Entry<byte[], byte[]>> set = map.entrySet();
		for(Entry<byte[], byte[]> e : set) {
			...
		}

猜你喜欢

转载自blog.csdn.net/dreamzuora/article/details/84967761