Does classroom diversity improve intergroup relations? Short- and long-term effects of classroom diversity for cross-ethnic friendships and anti-immigrant attitudes in adolescence

This study examined short- and long-term effects of ethnic classroom diversity for intergroup relations in adolescence. Using a five-year panel of Swedish majority youth (MageT1 = 13.40, MageT5 = 17.30), we found only limited direct effects of classroom diversity on anti-immigrant attitudes. However, classroom diversity increased the likelihood of cross-ethnic friendships, which in turn was associated with lower levels of anti-immigrant attitudes. Moreover, we found that the effect of classroom diversity on friendships remained also after adolescents transitioned to new schools. The findings highlight the importance of longitudinal analyses and contribute to a deeper understanding of how intergroup relations develop during adolescence. It brings new insights related to the longevity of classroom effects and to cross-ethnic friendships’ ability to mediate the diversity–attitudes relationship.

contribute to improved intergroup relations. One setting in which contact opportunities are particularly salient is the school context. The growing ethnic diversity in European societies is reflected in the ethnic composition of school classrooms, which makes them one of the most likely places for youth to meet and have sustained interactions with people of various ethnic backgrounds. The school years is also a time when social influences become increasingly important (Raabe & Beelmann, 2011). It is a critical time for the development of ethnic identities (French et al., 2006) and a time when the peer context is particularly salient (Brechwald & Prinstein, 2011), factors that arguably make youth more sensitive to intergroup contact experiences. In addition, while recent longitudinal studies found that contact improved intergroup attitudes in adolescence, the effect wore off as the young reached early adulthood (Miklikowska, 2017;Wölfer et al., 2016). In line with the formative years hypothesis (Krosnick & Alwin, 1989), this suggests that adolescence is a critical period for the formation of social and political attitudes, but also that it is a period of opportunity when it comes to reducing prejudice by intergroup contact.
The time spent in education during adolescence implies that schools and classrooms hold the potential to be important socializing contexts. Indeed, there is a growing literature focusing on how classroom composition affects intergroup relations both in terms of cross-ethnic friendships (Bagci et al., 2014;Bellmore et al., 2007) and prejudice (Dejaeghere et al., 2012;Thijs & Verkuyten, 2014). These studies, however, are rarely longitudinal, which means that there is limited knowledge about how the effects of classroom composition play out over time, including if any effects persist after students leave the classrooms. Also, although previous research has identified cross-ethnic friendships to be particularly powerful for reducing prejudice (Davies et al., 2011), studies of classroom diversity have largely overlooked its mediating role in the diversity-prejudice relationship. This is unfortunate as it may explain why some studies show that classroom diversity reduces prejudice (van Geel & Vedder, 2011) while others find no (Dejaeghere et al., 2012) or even the reversed effect (Vervoort et al., 2011), which potentially can be traced to the amount of time it takes for cross-ethnic friendships to develop.
In this study, we add to previous research by examining the longitudinal effects of classroom diversity on the development of anti-immigrant attitudes and cross-ethnic friendships in adolescence. Using a 5-year panel of Swedish adolescents (aged 13-17), we study (a) the direct effects of classroom diversity on anti-immigrant attitudes and cross-ethnic friendships, (b) the indirect effect on attitudes via cross-ethnic friendships, and (c) the longevity of any effects. That is, we ask if the effects of classroom diversity at T1-T3, on both anti-immigrant attitudes and cross-ethnic friendships, persist 2 years after adolescents have left the classroom (T4 and T5). In this sense, the current research advances knowledge of if and how integration measures in schools can influence intergroup relations both in the short and in the longer run.

The Role of Ethnic Diversity for Intergroup Relations
In the literature, greater diversity is approached both as a precedent of social tension and as an avenue to improved intergroup relations. Putnam (2007) outlines ethnic diversity as being associated with a variety of negative outcomes, including eroding social solidarity and trust. Group threat theory (Blalock, 1967;Blumer, 1958), similarly, predicts that as more diverse contexts imply tougher competition over scarce resources, diversity will increase feelings of threat which, in turn, will elicit antiminority attitudes among majority populations. A different scenario can be derived from intergroup contact theory (Allport, 1958;Pettigrew, 1998). It posits that insofar as ethnic diversity increases positive contact between members of majority and minority groups, it will facilitate positive attitudes and improve intergroup relations. As people establish positive contact with members of out-groups, any initial feeling of anxiety will wane in parallel with growing empathy (Pettigrew & Tropp, 2008). As a result, attitudes towards out-groups will gradually become more positive.
While diversity in this sense holds the potential to improve attitudes, recent work highlights how the actual degree of intergroup contact is key to this relationship, as segregation may work in the opposite direction (Pettigrew & Hewstone, 2017). Developmental intergroup theory (Bigler & Liben, 2007) emphasizes how segregation facilitates prejudice in children as they adopt beliefs about inherent differences between groups in order to make sense of and justify divisions they observe in society. Also, attempts to reconcile contact and competition theories have found out-group presence without intergroup contact to be conducive to prejudice in adult samples (Kaufmann & Goodwin, 2018;Laurence et al., 2019).
Even in contexts where there is contact, its relationship to prejudice is dependent on certain conditions. According to Allport's original requirements (1958), intergroup contact reduces prejudice primarily if the people involved have equal status (in the situation where the contact takes place), if they cooperate and work together towards a shared goal, and if they experience support from authorities. While later theorizing suggests that these conditions are facilitating rather than essential (Pettigrew & Tropp, 2006), one additional condition has emerged as particularly important: the contact must provide opportunities to become friends. Friendships are more likely to invoke key mediating processes such as reduced anxiety (Paolini et al., 2004;Voci & Hewstone, 2003) and enhanced empathy (Miklikowska, 2017;Pettigrew & Tropp, 2008), and can therefore more effectively reduce prejudice compared to more superficial contacts. Also, close and prolonged contacts may effectively counter prejudice, as they imply enough time for effects to generalize from single situations to attitudes towards the out-group as a whole (Paolini et al., 2004;Pettigrew, 1998).
In terms of how cross-ethnic friendships come into being, ethnic diversity is a precondition as they cannot be formed in strictly homogeneous environments. The literature on friendship formation identifies two principles particularly important to the formation of cross-ethnic friendships: propinquity and homophily (Hallinan & Williams, 1989). Propinquity refers to the tendency to form friendships with others who share the same social situation. As far as this principle applies, cross-ethnic friendships should be more common in high-diversity contexts than in lowdiversity contexts. Meanwhile, friendship choices are also guided by homophily (i.e., by the preference to socialize with others who share similar characteristics). Although this similarity theoretically can be of any kind, studies have found racial and ethnic belonging to be particularly important grounds for identification (McPherson et al., 2001;Smith et al., 2014), suggesting that crossethnic friendships may be rare even in diverse settings.
Still, the likelihood of such friendships increases if the contact situation is characterized by Allport's conditions (Pettigrew, 1998), including equal status, cooperation, shared goals, and institutional support. Taken together, the literature suggests that ethnic diversity holds the potential to improve intergroup relations in two different albeit interrelated ways: by enabling friendships and reducing prejudice.

The Role of Classroom Diversity for Anti-Immigrant Attitudes and Cross-Ethnic Friendships
Classrooms are one of the most suitable settings for the study of contact effects on intergroup relations. In classrooms, students of different backgrounds often come into close and prolonged contact with each other. Although there may be microsegregation in the sense that smaller friendship groups are formed along ethnic lines Vermeij et al., 2009), the classroom commonly makes for close interactions also with people outside the immediate circle of friends. Indeed, children in a classroom all have the same formal status as students, they work together on assignments that require cooperation and shared goals, all under supervision by a teacher who is more likely to encourage than to undermine intergroup contacts. Classrooms, in this sense, are suitable to test the more optimistic scenario derived from intergroup contact theory, not only as classroom diversity inevitably implies contact, but also as this contact has friendship potential in two important ways. First, it extends over time, and second, it fulfills the facilitating conditions originally specified by Allport (1958). 1 Classrooms further reduce the risk of reversed causality. Previous research shows that people sympathetic to other groups are more prone to seek their company compared to people with less positive attitudes (Binder et al., 2009), suggesting that there is an imminent risk of reversed causality in studies of diversity. Although individuals' control over where they go to school varies with educational system, children's ingoing prejudice is generally not a main determinant of who ends up in the same classroom. While parents' attitudes theoretically may have some bearing both on classrooms and children's attitudes (Miklikowska, 2016), the risk that this will fully explain any observed relationship is significantly lower than in other contexts of optimal contact, for example, voluntary organizations or peer groups. Further, longitudinal studies demonstrate that when controlling for ingoing attitudes, contact still has an independent effect on prejudice (Christ et al., 2014;Levin et al., 2003). Also, although results are mixed (cf. Binder et al., 2009), there are indications of a stronger link from contact to prejudice than from prejudice to contact (Pettigrew, 1997;Powers & Ellison, 1995).
Given the potential of the classroom setting for studying the effects of diversity, a number of studies have examined its role for ethnic and racial attitudes in adolescence. These, however, do not provide any unified picture of the implications of classroom diversity (for review, see Thijs & Verkuyten, 2014). Studying a Dutch sample, van Geel and Vedder (2011) found a positive relationship between classroom diversity and youth support for multiculturalism. Greater heterogeneity, they demonstrated, implied less ethnic antagonism among adolescents, a pattern also observed by Bubritzki et al. (2018) with regard to several different outgroups and in four different European countries. While findings by Janmaat (2012) also support intergroup contact theory, other studies observed no effect of classroom diversity (Bekhuis et al., 2013;Janmaat, 2015;Stark et al., 2015). Dejaeghere et al. (2012) studied ethnocentrism among late adolescents and found no direct link to the classroom context. The same applies to Kokkonen et al. (2010) who, in a Swedish study, concluded that there was neither a negative nor a positive effect of classroom diversity. This, in turn, is at odds with findings by Vervoort et al. (2011). Investigating a sample of Dutch adolescents, they found that greater classroom diversity enhanced negative out-group attitudes both among ethnic majority and minority youth.
In support of the principle of propinquity (Hallinan & Williams, 1989), studies have repeatedly shown that heterogeneity at classroom and school levels is positively related to the number of cross-ethnic friendships (Bagci et al., 2014;Bellmore et al., 2007;Joyner & Kao, 2000;Stearns, 2004), and that diversity increases the likelihood of attaining cross-ethnic friends over time (Titzmann et al., 2015). However, ethnic and racial homophily is also important (McPherson et al., 2001), and studies have found that both types of processes are at play in ethnically diverse schools. For example, Quillian and Campbell (2003) found that diversity simultaneously increases the number of outgroup friends and the relative preference for in-group friendships. A study by Moody (2001) suggests that homophily is particularly important in moderately diverse schools. The explanation put forward is that moderately diverse settings make racial categories salient and increase intergroup threat. As such experiences are less pertinent in highly heterogeneous environments, cross-ethnic friendships increase again as heterogeneity grows further.

Current Study
One important limitation in previous research is that the relationships between classroom diversity and intergroup attitudes and friendships have rarely been modelled over time, and when they have, the analysis has covered short-time periods.
To our knowledge, previous studies have followed students for maximum 2 years (see Dejaeghere et al., 2012;Titzmann et al., 2015), and not after the students have left the classroom. The exception is a study by Janmaat (2015), who used three waves of British data gathered during a 4-year period and found no relationship between classroom diversity and inclusive immigrant attitudes. In the current study, we advance knowledge of the longitudinal relationships between classroom diversity and intergroup attitudes and friendships by following adolescents for 5 years. In a first step, we examine the direct effect of classroom diversity on anti-immigrant attitudes and cross-ethnic friendships over the course of 3 years that the adolescents spent in the same classroom. In line with intergroup contact theory, we expect a negative relationship between classroom diversity and anti-immigrant attitudes, and a positive relationship between classroom diversity and cross-ethnic friendships. As it takes time for friendships to develop, we also expect any effects of classroom diversity to grow stronger with time spent in the classroom.
There is also limited knowledge about the mechanisms behind classroom diversity effects. While intergroup contact theory considers close high-quality relationships to be particularly effective in reducing prejudice , previous studies of classroom diversity have largely overlooked the possibility of its indirect effect, via intergroup friendships. One exception is Ellison and Powers (1994), who found that the development of intergroup friendships constituted an important intermediate step, linking early exposure to diversity (including in schools) to adult racial attitudes. A British study also demonstrated positive indirect effects of neighborhood diversity on out-group attitudes, via positive experiences of intergroup contact , but it is unclear to what extent this applies to classrooms. In a second step, therefore, we examine the indirect effect of classroom diversity on anti-immigrant attitudes, via the formation of cross-ethnic friendships. Given the key role assigned to friendships in intergroup contact theory, we expect cross-ethnic friendships to mediate a significant part of the classroom effect on anti-immigrant attitudes. Meanwhile, there is also a longitudinal aspect to any intermediate role of intergroup friendships, as "optimal intergroup contact requires time for cross-group friendships to develop" (Pettigrew, 1998, p. 76). Although superficial relationships can be established within a relatively short time span, high-quality characteristics such as mutual trust and high degrees of self-disclosure typically develop gradually as these relationships deepen (Davies et al., 2011). Thus, we do not expect classroom contact to translate immediately into its most effective form, that is, into close intergroup friendships. Instead, we expect key mediating processes related to these friendships to emerge gradually, which also might delay any direct effect of classroom diversity on out-group attitudes.
In the third step, we examine the longevity of classroom diversity effects. Specifically, we examine how experiences of classroom diversity influence cross-ethnic friendships and anti-immigrant attitudes after students have left the classroom. On the one hand, intergroup contact theory assumes that positive contact invokes changes in attitudes that are more or less permanent, leading to the expectation of diversity effects that persist over time. This expectation is supported by studies demonstrating a positive relationship between retrospective indicators of childhood diversity and cross-ethnic friendships (Ellison & Powers, 1994;Fischer, 2008;Schofield et al., 2010). On the other hand, ethnic homophily in both the formation and the retention of friendships suggests that any effect of classroom diversity may be transient. Studies on peer relations have found that cross-ethnic friendships generally are less stable and of lower quality than same-ethnic friendships (Aboud et al., 2003;Schneider et al., 2007), and that ethnic homophily tends to increase in late adolescence (Miklikowska, 2017;Wölfer et al., 2016). 2 Still, studies that actually test the longevity of intergroup contact effects in general, and classroom diversity effects in particular, are very rare. This is unfortunate, as knowledge of the stability (or lack thereof) of any diversity effect is key to understanding the long-term implications of contact experiences. Via these three steps, we set out to increase the understanding of if and how classroom diversity can influence intergroup relations both in the short and in the longer run.

Method
Data. In order to investigate the role of classroom diversity, we use data from a panel of Swedish adolescents from the Youth and Society Dataset (Amnå et al., 2010). The data were collected in a midsized Swedish city over a 6-year period (2010)(2011)(2012)(2013)(2014)(2015). The city was very similar to Sweden overall, with an average income, unemployment, and 17.6% non-Swedish residents (national average: 18.6% immigrants; Statistics Sweden, 2016). The data were collected in 10 schools which were sampled to ensure ethnic and social representation. Thirty-eight classrooms were targeted, and every class received €100.00 for participation. The classrooms had an average size of N = 24 and remained largely intact over the first 3 years of the study (seventh to ninth grade). Up until ninth grade, learning activities are to a large extent classroom-based, which implies that students spend much time with the same student group. After ninth grade, students left for high school where they were assigned to new classes. These classes were largely composed of students outside of the current sample.
For the purpose of this study, we rely on a subsample of the larger panel, which covers N = 946 adolescents (50.7% girls). Participants with an immigrant background (i.e., with at least one parent born outside of the Nordic countries) as well as four classrooms with less than four participants were excluded. The final sample included N = 661 adolescents in 34 classrooms. The respondents were aged 13 (M = 13.40, SD = 0.52) at T1, and 17 (M = 17.30, SD = 0.48) at T5. Attrition rate over the 5 years was 28.57%, which is not trivial but comparable to other panel studies on adolescents covering a shorter time span (Dejaeghere et al., 2012;Stearns et al., 2009). Attrition (dropout = 0, retention = 1) was analyzed with logistic regression analyses. The results showed that attrition was not related to the study variables, except for classroom diversity. Although adolescents from less diverse classrooms were more likely to remain in the study at T5, χ 2 (1, N = 640) = 9.40, p < .01, low value of Nagelkerke R 2 = .02 suggested that this difference would have small chance of affecting the analyses (Borooah, 2001). Attrition was not related to adolescent gender but youth with higher perceived economic status were less likely to drop out, χ 2 (1, N = 609) = 7.68, p < .01. Low value of Nagelkerke R 2 = .01 suggested that this difference would have small chance of affecting the analyses (Borooah, 2001). Analysis of missing data showed that the average proportion of missing data for all study variables was 27%. To account for the missing data, full information maximum likelihood (FIML) was used. Research has shown that FIML is superior to list-wise and pair-wise deletion (Enders & Bandalos, 2001) as well as multiple imputation (Larsen, 2011).

Measures
Anti-immigrant attitudes. At each wave, adolescents were asked about their attitudes toward immigrants in relation to three statements: "Immigrants often come here just to take advantage of welfare in Sweden," "Immigrants often take jobs from people who are born in Sweden," and "It happens too often that immigrants have customs and traditions that do not fit into Swedish society." For each statement, respondents reported to what extent it corresponds to their own position by marking their answer on a 4-point Likert scale (1 = doesn't apply at all, 4 = applies very well). The items are very close to items in the European Social Survey (ESS 2002(ESS -2016, which has been widely used to tap anti-immigrant attitudes (e.g., Hjerm, 2009;Legewie, 2013). Also, they have previously been found to display convergent, predictive, as well as discriminant validity (Miklikowska, 2017;van Zalk & Kerr, 2014). We used the item means to construct the scale score, generating a variable ranging between 1 and 4, with higher values indicating stronger anti-immigrant attitudes. Cronbach's alpha indicated good internal reliability of the scale: .77, .79, .79, .81, and .83 at T1-T5, respectively.
Cross-ethnic friendships. At each wave, respondents were asked to name up to eight of their closest friends at school; 92.3% of the adolescents nominated at least one friend at T1, and 71.1% at T5. If a nominated friend was not part of the study (i.e., not in any of the sampled classrooms), he or she was sent a survey that included questions on immigrant background. Based on these nominations, we calculated the proportion of immigrant friends in each adolescent's network, defined as the proportion of nominated friends with at least one parent born outside of the Nordic countries. The proportion of cross-ethnic friendship at T1 ranged from 0 to 1 (M = 0.16, SD = 0.19); 41.1% of the adolescents did not nominate any friend with immigrant background. At T5, the proportion of cross-ethnic friendship ranged from 0 to 1 (M = 0.15, SD = 0.21), and 34.8% of the adolescents did not nominate any friend with immigrant background. For the purpose of the analyses, we grand-mean centered the friendships variable.
Classroom diversity. Classroom diversity was calculated as the proportion of adolescents with an immigrant background (i.e., with at least one parent born outside of the Nordic countries). This generated a variable with scores ranging from 0 to .56 (M = 0.20, SD = 0.14). Classroom belonging was very stable over the first three waves, with only a negligible number of adolescents changing classroom during junior high school. Students that did change classrooms were coded into the classroom they spent most time in (N = 8), or deleted if they spent each measured year in a different classroom (N = 5). Thus, we measure classroom diversity as a time-invariant variable, varying between classrooms but not between time points. At T4, the adolescents changed schools and were assigned to new classrooms. These are largely comprised of adolescents outside the sample, which means that we do not have enough information to compute diversity scores for T4 and T5. The diversity variable, therefore, captures classroom diversity during T1-T3. The advantage of also following the adolescents 2 years into high school is that we can assess to what extent their previous classroom context continues to influence their anti-immigrant attitudes and friendships after they have left the classroom. For the purpose of the analysis, we grand-mean centered the diversity variable.
Controls. As we know from previous research that socioeconomic status is related both to ethnic classroom composition (Böhlmark et al., 2016) and to anti-immigrant attitudes (van Setten et al., 2017), we include a control for perceived socioeconomic status measured at classroom level. At every wave, adolescents reported on their perceived economic situation of their family by answering the question "What are your family finances like?" on a 4-point scale (1 = my parents always complain that they don't have enough money, 4 = my parents never complain about being short of money; T1 M = 3.01, SD = 0.79), and the question "If you want things that cost a lot of money (e.g., a computer, skateboard, cell phone), can your parents afford to buy them if you want them?" on a 5-point scale (1 = absolutely not, 5 = yes, absolutely; T1 M = 3.65, SD = 0.98). Using z scores for each variable, we created a combined measure of perceived economic status, which then was aggregated at the classroom level. This generated our measure of perceived classroom economic status. The scores ranged from −.38 to .44, with higher values indicating higher classroom economic status. For the purpose of the analysis, we centered the variable on its grand-mean. We also controlled for perceived economic status measured at the individual level and for gender.
Analytical strategy. The data are characterized by a three-level structure, with time points (Level 1) nested in individuals (Level 2) nested in classrooms (Level 3). This hierarchical structure requires analytical tools that simultaneously incorporate information at all levels while also controlling for the statistical dependence between repeated observations on the same subject. To meet these requirements, we use multilevel models in Mplus 8 (Muthén & Muthén, 1998-2017. The analysis was carried out in three steps. In the first step, we modeled the direct effect of classroom diversity on anti-immigrant attitudes (Model 1) as well as the direct effect of classroom diversity on cross-ethnic friendships (Model 2) over the course of the 3 years the adolescents spent in the same classroom (T1-T3). Initially, we specified unconditional random intercept models to examine how much variance in anti-immigrant attitudes (Model 1A) and in cross-ethnic friendships (Model 2B) there was at each of the three levels (intraclass correlations [ICCs]). Next, we modeled the average slope (i.e., change) in antiimmigrant attitudes and cross-ethnic friendships by adding a fixed effect of time (Model 1B, Model 2B), and further, the variance around this slope by specifying random effects of time across classrooms and individuals (Model 1C, Model 2C). Finally, Models 1D and 2D examined the effects of classroom diversity on the level and slope of  anti-immigrant attitudes and cross-ethnic friendships (T1-T3).
In the second step, we examined the indirect effect of classroom diversity on anti-immigrant attitudes, via cross-ethnic friendships. The mediation model included a fixed linear slope at the lowest level, direct paths from classroom diversity to the level of adolescents' attitudes and crossethnic friendships, as well as a direct path from youth cross-ethnic friendships to their attitudes.
In the third and final step, we address the question of the longevity of the effects of classroom diversity on anti-immigrant attitudes and cross-ethnic friendships by regressing youth prejudice and friendships scores after adolescents left classrooms (i.e., at T4 and T5) on classroom diversity (T1-T3).

Direct effects of classroom diversity on adolescents' crossethnic friendships and anti-immigrant attitudes.
To examine the direct effect of class diversity on anti-immigrant attitudes (1,722 observations), we specified four models (Models 1A-D). Intraclass correlations from the unconditional, random intercept model (Model 1A) identified 42% of variance between adolescents and 5% between classrooms. Adding the linear fixed slope (Model 1B) improved model fit and reduced unexplained variance. The average linear increase in youth attitudes was significant, showing that students became more negatively disposed towards immigrants. The variations around the slope at the between-person and between-classroom levels were not significant (σ² = .02, p = .103, 95% CI [0.00, 0.04] and σ² = .01, p = .096, 95% CI [0.00, 0.01], respectively), indicating that there were no significant differences between adolescents and between classrooms in their rate of change (Model 1C). Thus, variations around the slopes as well as correlations between the levels and the slopes were constrained to zero. Finally, we included grand-mean-centered class diversity to assess the differences in prejudice between highand low-diversity classrooms (Model 1D). This further improved model fit and reduced unexplained variance. The results showed that, on average, students in high-diversity classrooms had lower level prejudice compared to students in low-diversity classrooms. The predicted difference in the sample is .61 * .56 = .34, which should be interpreted as the predicted difference in anti-immigrant attitudes between adolescents attending the most and the least diverse classroom. All model fit indices and parameter estimates are presented in Table 2. Additional analyses showed that the effect of classroom diversity on level of anti-immigrant attitudes did not change substantially (B = −0.65, p = .006; B = −0.59, p = .008; B = −0.62, p = .005) when controlling for individual-and classroom-level perceived SES (B = −0.01, p = .644 and B = −0.20, p = .256, respectively) 3 and for gender (B = 0.16, p = .001). However, inspection of diversity effects at every time point revealed that classroom diversity was only significantly and negatively related to prejudice at T2, an effect which then disappeared at T3. Thus, the average effect of classroom diversity on prejudice in Model 1D is driven primarily by differences between high-and low-diversity classrooms at T2 (see Figure 1).
To examine the direct effect of class diversity on youth cross-ethnic friendships (1,694 observations), we specified four models (Models 2A-D). Intraclass correlations from the unconditional, random intercept model (Model 2A) identified 33% of the variance between adolescents and 3.5% between classrooms. Adding the linear fixed slope (Model 2B) did not improve model fit or reduce unexplained variance. Also, the average linear change was nonsignificant, demonstrating that there was no general development in crossethnic friendships. Still, there was significant variation around the slope at the between-person level (σ² = .002, p = .001, 95% CI [0.001, 0.003]), indicating significant differences between adolescents in their rate of change (Model 2C). Adding random slope at the between-person level also improved model fit. In contrast, at the betweenclassroom level, there was no significant variation around the slope (σ² = .000, p = .713, 95% CI [0.000, 0.000]), indicating that classrooms did not  differ in their rate of change. Thus, the variation around the slope as well as the correlation between the level and the slope at the betweenclassroom level were constrained to zero. Finally, we included grand-mean-centered class diversity to assess the differences in friendships between high-and low-diversity classrooms (Model 2D). This further improved model fit and reduced the unexplained variance. The results showed that, on average, students in high-diversity classrooms were more likely to engage in cross-ethnic friendships compared to students in low-diversity classrooms, an effect which was stable over the 3 years spent in the same classroom (see Figure 2). All model fit indices and parameter estimates are presented in Table 2 Interplay between classroom diversity and cross-ethnic friendships. To examine whether the effects of classroom diversity on classroom-level attitudes were mediated by classroom-level cross-ethnic friendships, we specified a 3-3-3 mediation model (predictor, mediator, and outcome at the classroom level). It included a fixed linear slope at the lowest level, direct paths from classroom diversity to the level of adolescents' attitudes and cross-ethnic friendships, as well as a direct path from youth cross-ethnic friendships to their attitudes at the classroom level. The direct effect of classroom diversity on youth cross-ethnic friendships was significant (B = 1.02, p = .001; 95% CI In addition, to examine whether classroom diversity could explain differences between adolescents in their friendships and attitudes, we tested a 3-2-2 mediation model (predictor at the classroom level, mediator and outcome at the individual level). This model included a fixed linear slope at the lowest level, direct paths from classroom diversity to the level of adolescents' attitudes and crossethnic friendships at the classroom level, as well as direct paths from youth cross-ethnic friendships at  Longevity of classroom effects. To test the longevity of the classroom diversity effects on prejudice, we regressed youth prejudice scores after adolescents have left their classroom (i.e., at T4 and T5) on classroom diversity (T1-T3). Regression analysis showed that classroom diversity was not a significant predictor of prejudice at T4, R 2 = .001, F(1, 49) = 0.69, p = .407, β = −.04, p = .407, or at T5, R 2 = .001, F(1, 48) = 0.69, p = .560, β = −.03, p = .560.

Discussion
Classrooms have been discussed as particularly suitable settings to study how contact affects antiimmigrant attitudes and cross-ethnic friendships in adolescence (Dejaeghere et al., 2012). Not only is the classroom a place where students are bound to interact regardless of their previous attitudes and experiences, it also displays many of the facilitating circumstances identified by intergroup contact theory (Allport, 1958;Pettigrew, 1998), including equal status among participants, common goals, and institutional support. While previous research has brought valuable insights into the role of classroom diversity in the formation of anti-immigrant attitudes and cross-ethnic friendships in adolescence, the lack of longitudinal studies implied a limited knowledge of how these relationships play out over time, including whether any effects remain after students have left the classroom. Moreover, despite the theoretical weight that contact theory assigns to intergroup friendships, previous research has largely studied the effects of classroom diversity on antiimmigrant attitudes and cross-ethnic friendships in isolation, not accounting for cross-ethnic friendships' potential to mediate the diversityattitudes relationship. Addressing these shortcomings, this study found no stable direct effect of classroom diversity on the development of anti-immigrant attitudes among Swedish majority youth. However, classroom diversity increased the likelihood of youth cross-ethnic friendships, which in turn was associated with lower levels of anti-immigrant attitudes. The effect of diversity on friendships remained after adolescents transitioned to new schools.
Classroom diversity and anti-immigrant attitudes. Results showed that students who attended high-diversity classrooms were less likely to hold anti-immigrant attitudes compared to students in low-diversity classrooms, but that this difference was mainly driven by attitudes at T2. While intergroup contact theory suggests that the effect of classroom diversity may vary over time, it primarily points towards a gradual increase in the diversity effect. This as (a) contact effects benefit from the development of close cross-ethnic friendships, something that generally requires time, but also as (b) contact effects are more likely to generalize from individual relationships to out-group attitudes if group salience has had time to unfold from decategorization to categorization to recategorization (Pettigrew, 1998). Still, in our study, the effect of classroom diversity is statistically significant only at T2; students' second out of 3 years together. Considering what can explain this somewhat surprising pattern, previous research has identified a number of factors that may impinge on the diversity-attitude relationship. For example, the literature on positive and negative contact effects emphasizes how the attitudinal consequences of diversity vary with the nature of intergroup interactions (Aberson, 2015;Barlow et al., 2012). Although classrooms generally are considered beneficial for positive contact, negative contact experiences still occur. If such negative experiences are commonplace, they may cancel out or even reverse the effects of positive contact. Indeed, a study by Stark et al. (2015) found that classroom diversity had different consequences depending on whether out-group classmates were liked or disliked. Further, studies have found multicultural education to moderate the diversity effect, by making positive contact less efficient in reducing negative attitudes (Bekhuis et al., 2013). While shifts in positive/negative contact experiences and multicultural education theoretically may explain the diminishing diversity effect, we lack the means to test this empirically. However, given how the Swedish curriculum emphasizes that antidiscriminatory and democratic values should permeate teaching in all grades, and given our finding that the degree of classroom friendships is stable during T1-T3 (see Figure 2), it seems unlikely that the temporary effect can be explained by curriculum changes or by a general decrease in positive contact, at least in terms of friendships.
Although somewhat surprising, the decrease in effect between T2 and T3 is partly in line with research showing declining effects of intergroup friendships on prejudice from mid-to late adolescence (Miklikowska, 2017;Wölfer et al., 2016), as well as studies showing increasing resistance to peer influences in later adolescence (Steinberg & Monahan, 2007). That intergroup contact becomes less effective in late adolescence is further sustained by how attitudes emerged as unrelated to friendships at T5. It is also in line with the formative years hypothesis (Krosnick & Alwin, 1989), which predicts increasing attitudinal stability as individuals age. Taken together, this suggests that early adolescence might be a critical period for the implementation of contact strategies at schools.
As the longevity analysis reveals no significant differences in attitudes after the students have left the classroom, we conclude that classroom diversity in the studied grades (early to midadolescence) has little bearing on anti-immigrant attitudes in late adolescence. In this sense, our results provide no support for the theoretical expectations derived from intergroup contact theory that classroom contact per se can reduce prejudice in the long term. However, neither do our findings imply support for more pessimistic scenarios where diversity leads to greater intergroup tension. The lack of a stable diversity effect concurs with findings in previous crosssectional studies on prejudicial attitudes in Sweden (Kokkonen et al., 2010) and in other countries (Dejaeghere et al., 2012;Janmaat, 2015), but our longitudinal analysis provides more robust evidence in this regard.

Classroom diversity and cross-ethnic friendships.
Although we find that classroom diversity has no stable direct effect on anti-immigrant attitudes, this does not imply that it is irrelevant to intergroup relations, or even to anti-immigrant attitudes. Examining the relationship between classroom diversity and cross-ethnic friendships during the time when students are in the same classroom, we find that adolescents in more diverse classrooms are significantly more prone to engage in cross-ethnic friendships. This is in line with the principle of propinquity, which suggests that more friendship opportunities predict more friendships, and with previous studies showing that classroom diversity facilitates friendships (Bagci et al., 2014;Bellmore et al., 2007;Joyner & Kao, 2000;Stearns, 2004;Titzmann et al., 2015).
In addition, we find that cross-ethnic friendships mediate the relationship between classroom diversity and anti-immigrant attitudes. This indirect effect suggests that classroom diversity promotes the development of cross-ethnic friendships, which in turn leads to less anti-immigrant attitudes. This result suggests that school diversity can counteract development of negative attitudes in adolescence through its positive effects on friendship formation.
The results showed that the difference in crossethnic friendships between high-and low-diversity classrooms persisted also after adolescents had left their T1-T3 classrooms. Once they were assigned to new classrooms at T4, the difference was markedly reduced, which indicates that classrooms indeed are an important arena for youth friendship formation. Nevertheless, 2 years after leaving the classroom, adolescents who spent T1-T3 in high-diversity classrooms remained more likely to have cross-ethnic friends compared to adolescents who spent this time in low-diversity classrooms. This suggests that classroom diversity can increase cross-ethnic friendships also in the longer term. Although these friendships seem to become less effective in reducing anti-immigrant attitudes as the respondents reach late adolescence (T4-T5), they may still have important consequences. For example, to the extent that mere knowledge of positive cross-ethnic relationships reduces out-group hostility (Zhou et al., 2018), these friendships may have important ripple effects on intergroup attitudes also among people not directly involved in the contact. Also, previous research has found intergroup friendships to be associated with positive individual outcomes such as social competence and leadership skills (Hunter & Elias, 1999;Kawabata & Crick, 2008), which suggests that diversity-induced friendships may have even broader implications.
Limitations and conclusions. Our study improves upon previous studies of classroom diversity effects by studying them longitudinally, by accounting for cross-ethnic friendships as a potential mediator of the diversity-attitude relationship, and by testing the longevity of these effects. Meanwhile, our study also has a number of limitations. First, our measure of cross-ethnic friendships only captures the share of immigrants among nominated friends and does not indicate friendship quality. Although one can assume that the limitation of eight best friends focuses the selection on people that the respondent considers being close friends, these may still vary in closeness and in quality. Second, we base the dependent variable on items that ask about perceived consequences of immigrant presence. While commonly used to capture anti-immigrant attitudes (see e.g., Legewie, 2013;Semyonov et al., 2008), these may also capture perceived immigrant threat (Pichler, 2010), which is a related, but not identical, construct.
Third, although adolescents have limited possibilities to choose who will attend the same classroom, the ethnic makeup of junior high school classrooms is still related to a number of external factors, not the least to the broader neighborhood and school compositions. While classrooms are the focus in much previous research, studies also indicate that neighborhoods and schools may be important to friendship choices and prejudicial attitudes (Northcutt Bohmert & DeMaris, 2015;Quillian & Campbell, 2003;Vermeij et al., 2009; but see Kruse et al., 2016). Unfortunately, our study provides no opportunities to model these alternative contexts to ensure that classroom diversity is indeed the key factor. Future research should set out to adjudicate between different diversity contexts, as well as examine the potential interplay between these in how they longitudinally influence cross-ethnic friendships and anti-immigrant attitudes (Miklikowska & Bohman, 2019;Miklikowska et al., 2019). Future studies should also seek to establish even longer panels that allow for the study of the longevity of classroom effects 5 or 10 years after the student have left the classroom. Ideally, such studies should also examine how classroom contexts interact with contexts encountered later in life (in higher education, the workplace).
This study contributes to the literature on consequences of classroom diversity for the development of prejudice and intergroup friendships in adolescence. It demonstrates that ethnically diverse classrooms hold the potential to reduce anti-immigrant prejudice, but that this relationship is less stable or straightforward than sometimes assumed. Although the direct effect of classroom diversity on anti-immigrant attitudes is temporal, it still influences such attitudes indirectly, via facilitating the formation of cross-ethnic friendships. Such friendships are more common in diverse classrooms, and this difference persists after adolescents change their classroom context. These findings offer support to policies aimed at increasing integration in school by showing that classroom diversity is relevant to how groups interact in the short and long term.

Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research was supported by grants from the Swedish Foundation for Humanities and Social Sciences (Grant No. P16-0446:1), the Swedish Research Council (Grant No. 2016-04165), and the Swedish Research Council for Health, Working Life and Welfare (Grant No. 2016-07177).

ORCID iD
Andrea Bohman https://orcid.org/0000-0001-8335 -9235 Notes 1. Besides the friendship potential, studies in college settings have also found that experiences of diversity in school can generate positive effects on cognitive development, including on critical thinking and problem-solving abilities (for an overview, see Bowman, 2010), which in turn may benefit the development of positive out-group attitudes (Engberg, 2004). 2. A recent study has found that changes in outgroup attitudes and national identity can buffer the growing ethnic homophily in adolescence (Wölfer & Hewstone, 2018). Although not directly focused on classroom diversity, this finding suggests that to the extent that early contact experiences lead to reductions in prejudice, they could also influence the degree of future contact. 3. While parental education would be a more direct measure of socioeconomic background, we only have data on this for a limited part of the sample (≈ 65%). In this restricted group, the significant relationship between classroom diversity and antiimmigrant attitudes remained (B = −0.58, p = .017) also when controlling for fathers' higher education (B = −0.20, p = .001) and mothers' higher education (B = −0.16, p = .003). Also, the significant relationship between classroom diversity and cross-ethnic friends remained (B = 0.66, p = .000; B = 0.69, p = .000) when we controlled for fathers' (B = −0.01, p = .731) and mothers' higher education (B = −0.00, p = .773). 4. We also tested whether cross-ethnic friendships would moderate the effects of classroom diversity.
We specified a moderation model which included paths from classroom diversity and friendships, as well as from the interaction term between them to the level of adolescents' attitudes. This model did not show better fit compared to the model with the interaction term constrained to zero, Δ-2LL = .02(1), p = .654; ΔBIC = −7.04. The path from the interaction term to the level of youth attitudes was not significant (B = 0.903, p = .527, 95% CI [−1.443, 3.249]), indicating that friendships did not moderate the effects of classroom diversity.