question: private OptionScanNode createTree ( List < OptionScanNode > treeNodes , int nodeType ) { if ( treeNodes == null || treeNodes . isEmpty ( ) ) { return null ; } else if ( treeNodes . size ( ) == 1 ) { return treeNodes . get ( 0 ) ; } else { List < OptionScanNode > otherChildren = treeNodes . subList ( 2 , treeNodes . size ( ) ) ; if ( nodeType == CONTEXT_MENU_NODE ) { return new ContextMenuNode ( ( ContextMenuItem ) treeNodes . get ( 0 ) , ( ContextMenuItem ) treeNodes . get ( 1 ) , otherChildren . toArray ( new ContextMenuItem [ otherChildren . size ( ) ] ) ) ; } else if ( nodeType == OPTION_SCAN_SELECTION_NODE ) { return new OptionScanSelectionNode ( treeNodes . get ( 0 ) , treeNodes . get ( 1 ) , otherChildren . toArray ( new OptionScanNode [ otherChildren . size ( ) ] ) ) ; } return null ; } }
target:  Given a list of nodes, unites the nodes under a common parent, by making them children of a common OptionScanNode