Repository: android/compose-samples
File: Owl/app/src/main/java/com/example/owl/ui/OwlApp.kt (Kotlin)

Code before:
        ProvideImageLoader {
            BlueTheme {
                val tabs = CourseTabs.values()
                val navController = rememberNavController()
                OwlScaffold(
                    bottomBar = { OwlBottomBar(navController = navController, tabs) }
                ) { innerPaddingModifier ->
                    NavGraph(
                        finishActivity = finishActivity,
                        navController = navController,
                        modifier = innerPaddingModifier
                    )
                }
            }
        }
    }
}

@Composable
fun OwlBottomBar(navController: NavController, tabs: Array<CourseTabs>) {

    val navBackStackEntry by navController.currentBackStackEntryAsState()
    val currentRoute = navBackStackEntry?.arguments?.getString(KEY_ROUTE)
        ?: CourseTabs.FEATURED.route

    if (currentRoute in CourseTabs.values().map { it.route }) {
        BottomNavigation(
            Modifier.navigationBarsHeight(additional = 56.dp)
        ) {
            tabs.forEach { tab ->
                BottomNavigationItem(
                    icon = { Icon(painterResource(tab.icon), contentDescription = null) },
                    label = { Text(stringResource(tab.title).toUpperCase()) },
                    selected = currentRoute == tab.route,
                    onClick = {
                        if (tab.route != currentRoute) {
                            navController.navigate(tab.route) {
                                popUpTo = navController.graph.startDestination
                                launchSingleTop = true
                            }
                        }
                    },
                    alwaysShowLabel = false,
                    selectedContentColor = MaterialTheme.colors.secondary,
                    unselectedContentColor = LocalContentColor.current,
                    modifier = Modifier.navigationBarsPadding()
                )
            }
        }
    }
}

Review comment (refactor):
nit: extract `CourseTabs.values().map { it.route }` to  const or `remember` or something. `values()` creates a new array every call, and then so will `map`

Code after:
    ProvideWindowInsets {
        ProvideImageLoader {
            BlueTheme {
                val tabs = remember { CourseTabs.values() }
                val navController = rememberNavController()
                Scaffold(
                    backgroundColor = MaterialTheme.colors.primarySurface,
                    bottomBar = { OwlBottomBar(navController = navController, tabs) }
                ) { innerPaddingModifier ->
                    NavGraph(
                        finishActivity = finishActivity,
                        navController = navController,
                        modifier = Modifier.padding(innerPaddingModifier)
                    )
                }
            }
        }
    }
}

@Composable
fun OwlBottomBar(navController: NavController, tabs: Array<CourseTabs>) {

    val navBackStackEntry by navController.currentBackStackEntryAsState()
    val currentRoute = navBackStackEntry?.arguments?.getString(KEY_ROUTE)
        ?: CourseTabs.FEATURED.route

    val routes = remember { CourseTabs.values().map { it.route } }
    if (currentRoute in routes) {
        BottomNavigation(
            Modifier.navigationBarsHeight(additional = 56.dp)
        ) {
            tabs.forEach { tab ->
                BottomNavigationItem(
                    icon = { Icon(painterResource(tab.icon), contentDescription = null) },
                    label = { Text(stringResource(tab.title).toUpperCase()) },
                    selected = currentRoute == tab.route,
                    onClick = {
                        if (tab.route != currentRoute) {
                            navController.navigate(tab.route) {
                                popUpTo = navController.graph.startDestination
                                launchSingleTop = true
                            }
                        }
                    },
                    alwaysShowLabel = false,
                    selectedContentColor = MaterialTheme.colors.secondary,
                    unselectedContentColor = LocalContentColor.current,
                    modifier = Modifier.navigationBarsPadding()
                )
            }