Code example for HashMap

Methods: size, values

0
		if(item == null) return 0;
		return item.counter;
	} 
	 
	private synchronized Item[] items() { 
		return map.values().toArray(new Item[map.size()]);
	} 
	 
	private synchronized Item[] sortedItems(final boolean ascending) {
		Item[] items = items();
		Arrays.sort(items, new Comparator<Item>() {
			@Override 
			public int compare(Item it0, Item it1) {
				int ret;
				if(it0.counter > it1.counter) ret = 1;
				else if(it0.counter < it1.counter) ret = -1;
				else ret = it0.string.compareTo(it1.string);
				if(!ascending) ret = -ret;
				return ret;
			} 
		});