public static SortedMap<Integer,Integer> generateSortedTagMap(String[] partitions,Map<String,String> tags){
  final SortedMap<Integer,Integer> tagHashMap=new TreeMap<Integer,Integer>();
  for (  Map.Entry<String,String> entry : tags.entrySet()) {
    final String tagName=entry.getKey();
    final String tagValue=entry.getValue();
    if (tagValue == null || isPartitionTag(partitions,tagName))     continue;
    tagHashMap.put(tagName.hashCode(),tagValue.hashCode());
  }
  return tagHashMap;
}

public static SortedMap < Integer , Integer > generateSortedTagMap ( String [ ] partitions , Map < String , String > tags ) { final SortedMap < Integer , Integer > tagHashMap = new TreeMap < Integer , Integer > ( ) ; for ( Map . Entry < String , String > entry : tags . entrySet ( ) ) { final String tagName = entry . getKey ( ) ; final String tagValue = entry . getValue ( ) ; if ( tagValue == null || isPartitionTag ( partitions , tagName ) ) continue ; tagHashMap . put ( tagName . hashCode ( ) , tagValue . hashCode ( ) ) ; } return tagHashMap ; }
generate the internal sorted hashmap for tags . please note the partition tags should not be included in the result map .
