public static < E , S extends MutableSortedBag < E > > UnmodifiableSortedBag < E > of ( S bag ) { if ( bag == null ) { throw new IllegalArgumentException ( "cannot create an UnmodifiableSortedBag for null" ) ; } return new UnmodifiableSortedBag < E > ( bag ) ; }
This method will take a MutableSortedBag and wrap it directly in a UnmodifiableSortedBag .