public static LinkedHashMap < String , List < String > > getTablesSorted ( List < String > allTableNames , boolean doSort ) { LinkedHashMap < String , List < String > > tablesMap = new LinkedHashMap <> ( ) ; tablesMap . put ( USERDATA , new ArrayList < String > ( ) ) ; tablesMap . put ( STYLE , new ArrayList < String > ( ) ) ; tablesMap . put ( METADATA , new ArrayList < String > ( ) ) ; tablesMap . put ( INTERNALDATA , new ArrayList < String > ( ) ) ; tablesMap . put ( SPATIALINDEX , new ArrayList < String > ( ) ) ; for ( String tableName : allTableNames ) { tableName = tableName . toLowerCase ( ) ; if ( spatialindexTables . contains ( tableName ) || tableName . startsWith ( startsWithIndexTables ) ) { List < String > list = tablesMap . get ( SPATIALINDEX ) ; list . add ( tableName ) ; continue ; } if ( tableName . startsWith ( startsWithStyleTables ) ) { List < String > list = tablesMap . get ( STYLE ) ; list . add ( tableName ) ; continue ; } if ( metadataTables . contains ( tableName ) ) { List < String > list = tablesMap . get ( METADATA ) ; list . add ( tableName ) ; continue ; } if ( internalDataTables . contains ( tableName ) ) { List < String > list = tablesMap . get ( INTERNALDATA ) ; list . add ( tableName ) ; continue ; } List < String > list = tablesMap . get ( USERDATA ) ; list . add ( tableName ) ; } if ( doSort ) { for ( List < String > values : tablesMap . values ( ) ) { Collections . sort ( values ) ; } } return tablesMap ; }
Sorts all supplied table names by type .