DimensionalObjectUtils { public static Map<String, Object> getSortedKeysMap( Map<String, Object> valueMap ) { Map<String, Object> map = new HashMap<>(); for ( String key : valueMap.keySet() ) { String sortKey = sortKey( key ); if ( sortKey != null ) { map.put( sortKey, valueMap.get( key ) ); } } return map; }  static List<DimensionalObject> getCopies( List<DimensionalObject> dimensions ); static List<String> getDimensions( Collection<DimensionalObject> dimensions ); static NameableObject[][] getItemArray( List<DimensionalObject> dimensions ); @SafeVarargs static Map<T, T> asMap( final T... elements ); static String getDimensionFromParam( String param ); static List<String> getDimensionItemsFromParam( String param ); static List<String> getItemsFromParam( String param ); static boolean anyDimensionHasItems( Collection<DimensionalObject> dimensions ); static String getValueFromKeywordParam( String param ); static String getUidFromGroupParam( String param ); static void setDimensionItemsForFilters( DimensionalObject dimension, Grid grid, boolean naForNull ); static String getPrettyFilter( String filter ); static boolean isCompositeDimensionalObject( String expression ); static String getFirstIdentifer( String compositeItem ); static String getSecondIdentifer( String compositeItem ); static boolean isWildCard( String identifier ); static List<DimensionalItemObject> getList( DimensionalItemObject... objects ); static List<DimensionalItemObject> asList( Collection<? extends DimensionalItemObject> collection ); static List<DimensionalObject> asDimensionalObjectList( Collection<? extends DimensionalObject> collection ); @SuppressWarnings("unchecked") static List<T> asTypedList( Collection<DimensionalItemObject> collection ); static List<DimensionalItemObject> getDimensionalItemObjects( Collection<?> values, boolean naForNull ); static List<String> getDimensionalItemIds( Collection<DimensionalItemObject> objects ); static Set<DimensionalItemObject> getDataElements( Collection<DataElementOperand> operands ); static Set<DimensionalItemObject> getCategoryOptionCombos( Collection<DataElementOperand> operands ); static Set<DimensionalItemObject> getAttributeOptionCombos( Collection<DataElementOperand> operands ); static Map<String, String> getDimensionItemIdSchemeMap( Collection<? extends DimensionalItemObject> objects, IdScheme idScheme ); static Map<String, String> getDataElementOperandIdSchemeMap( Collection<DataElementOperand> dataElementOperands, IdScheme idScheme ); static String getDimensionItem( String uid, ReportingRateMetric metric ); static List<DimensionalItemObject> replaceOperandTotalsWithDataElements( List<DimensionalItemObject> items ); static String getKey( List<DimensionalItemObject> column, List<DimensionalItemObject> row ); static Map<String, Object> getSortedKeysMap( Map<String, Object> valueMap ); static String sortKey( String key ); static String getKey( List<DimensionalItemObject> objects ); static String getName( List<DimensionalItemObject> objects ); static Map<DimensionalItemObject, Double> convertToDimItemValueMap(
        List<DimensionItemObjectValue> dimensionItemObjectValues ); static final String COMPOSITE_DIM_OBJECT_ESCAPED_SEP; static final String COMPOSITE_DIM_OBJECT_PLAIN_SEP; static final String TITLE_ITEM_SEP; static final String NULL_REPLACEMENT; static final String NAME_SEP; static final String COL_SEP; }
@Test public void testSortKeys() { Map<String, Object> valueMap = new HashMap<>(); valueMap.put( "b1-a1-c1", 1d ); valueMap.put( "a2-c2-b2", 2d ); valueMap.put( "c3-b3-a3", 3d ); valueMap.put( "a4-b4-c4", 4d ); Map<String, Object> sortedMap = DimensionalObjectUtils.getSortedKeysMap( valueMap ); assertEquals( 4, sortedMap.size() ); assertTrue( sortedMap.containsKey( "a1-b1-c1" ) ); assertTrue( sortedMap.containsKey( "a2-b2-c2" ) ); assertTrue( sortedMap.containsKey( "a3-b3-c3" ) ); assertTrue( sortedMap.containsKey( "a4-b4-c4" ) ); assertEquals( 1d, sortedMap.get( "a1-b1-c1" ) ); assertEquals( 2d, sortedMap.get( "a2-b2-c2" ) ); assertEquals( 3d, sortedMap.get( "a3-b3-c3" ) ); assertEquals( 4d, sortedMap.get( "a4-b4-c4" ) ); valueMap = new HashMap<>(); valueMap.put( "b1", 1d ); valueMap.put( "b2", 2d ); sortedMap = DimensionalObjectUtils.getSortedKeysMap( valueMap ); assertEquals( 2, sortedMap.size() ); assertTrue( sortedMap.containsKey( "b1" ) ); assertTrue( sortedMap.containsKey( "b2" ) ); assertEquals( 1d, sortedMap.get( "b1" ) ); assertEquals( 2d, sortedMap.get( "b2" ) ); valueMap = new HashMap<>(); valueMap.put( null, 1d ); sortedMap = DimensionalObjectUtils.getSortedKeysMap( valueMap ); assertEquals( 0, sortedMap.size() ); }