public synchronized static Set < MeasureUnit > getAvailable ( ) { Set < MeasureUnit > result = new HashSet < MeasureUnit > ( ) ; for ( String type : new HashSet < String > ( MeasureUnit . getAvailableTypes ( ) ) ) { for ( MeasureUnit unit : MeasureUnit . getAvailable ( type ) ) { result . add ( unit ) ; } } // Train users not to modify returned set from the start giving us more // flexibility for implementation. return Collections . unmodifiableSet ( result ) ; }
Get all of the available units . Returned set is unmodifiable .