public function getSortedTags() {
		if ($this->comparator === null) {
			$this->comparator = new TagNameComparator(); 
		}

		// 1) group by tag name
		$group = new Map();
		foreach ($this->tags as $tag) {
			if (!$group->has($tag->getTagName())) {
				$group->set($tag->getTagName(), new ArrayList());
			}
			
			$group->get($tag->getTagName())->add($tag);
		} 
		
		// 2) Sort the group by tag name
		$group->sortKeys(new TagNameComparator());
		
		// 3) flatten the group
		$sorted = new ArrayList();
		foreach ($group->values() as $tags) {
			$sorted->addAll($tags);
		}
		
		return $sorted;
	}
public function getSortedTags() {
		if ($this->comparator === null) {
			$this->comparator = new TagNameComparator(); 
		}

		// 1) group by tag name
		$group = new Map();
		foreach ($this->tags as $tag) {
			if (!$group->has($tag->getTagName())) {
				$group->set($tag->getTagName(), new ArrayList());
			}
			
			$group->get($tag->getTagName())->add($tag);
		} 
		
		// 2) Sort the group by tag name
		$group->sortKeys(new TagNameComparator());
		
		// 3) flatten the group
		$sorted = new ArrayList();
		foreach ($group->values() as $tags) {
			$sorted->addAll($tags);
		}
		
		return $sorted;
	}
public function getSortedTags ( ) { if ( $ this -> comparator === null ) { $ this -> comparator = new TagNameComparator ( ) ; } // 1) group by tag name $ group = new Map ( ) ; foreach ( $ this -> tags as $ tag ) { if ( ! $ group -> has ( $ tag -> getTagName ( ) ) ) { $ group -> set ( $ tag -> getTagName ( ) , new ArrayList ( ) ) ; } $ group -> get ( $ tag -> getTagName ( ) ) -> add ( $ tag ) ; } // 2) Sort the group by tag name $ group -> sortKeys ( new TagNameComparator ( ) ) ; // 3) flatten the group $ sorted = new ArrayList ( ) ; foreach ( $ group -> values ( ) as $ tags ) { $ sorted -> addAll ( $ tags ) ; } return $ sorted ; }
A list of tags sorted by tag-name

@return ArrayList
A list of tags sorted by tag - name