LinkedListMultimap用法



public static void main(String[] args) {
		LinkedListMultimap groupdMap = LinkedListMultimap
				.create();
		for (int i = 0; i < 100; i++) {
			groupdMap.put(i % 10, "value_" + i);
		}
		System.out.println("" + groupdMap.size());
		System.out.println("" + groupdMap.keys().size());
		System.out.println("" + groupdMap.keySet().size());
		System.out.println("" + groupdMap.get(0));
		Iterator> it = groupdMap.entries().iterator();
		int count = 0;
		while (it.hasNext()) {
			it.next();
			System.out.println(count);
			count++;
		}
	}

 

100
100
10
[value_0, value_10, value_20, value_30, value_40, value_50, value_60, value_70, value_80, value_90]

 

 

Iterator>> it2 = groupdMap.asMap()
				.entrySet().iterator();

		int count2 = 0;
		while (it2.hasNext()) {
			it2.next();
			System.out.println(count2);
			count2++;
		}

 

0
1
2
3
4
5
6
7
8
9

 

api:http://tool.oschina.net/apidocs/apidoc?api=guava

 

mvn:

mvn:

com.google.collections
google-collections
1.0
jar

 

jar包 见附件:

你可能感兴趣的:(java基础)