1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | package Torello.JavaDoc; import Torello.Java.ReadOnly.ReadOnlyArrayList; import Torello.Java.ReadOnly.ReadOnlyList; import Torello.JDUInternal.MainJDU.ClassUpgradeData.UpgradeSettings; class OverviewFrameSorter { static void set( final String[] sectionNames, final String[][] sectionContents, final UpgradeSettings.Builder settingsBuilder ) { // This can only be sorted if it is first created / turned-on. settingsBuilder.generateFrames = true; settingsBuilder.overviewFrameSections = new ReadOnlyArrayList<String>(sectionNames); // Generics & Arrays do not always look so nice... In the code below: // // String[][] sectionContents is cast to Object[], to "help" the javac Generics-Processor // Object o is then cast back to String[], also to "help" the javac Generics-Processor // // Note that this.settingsBuilder.overviewFramePackages is declared using type: // public ReadOnlyList<ReadOnlyList<String>> overviewFramePackages settingsBuilder.overviewFramePackages = new ReadOnlyArrayList<ReadOnlyList<String>>( (Object o) -> new ReadOnlyArrayList<String>((String []) o), (Object[]) sectionContents ); } } |