Skip to content

Instantly share code, notes, and snippets.

@MaksimDmitriev
Created November 4, 2023 04:07
Show Gist options
  • Save MaksimDmitriev/21d5be2789434fb871ddec7f07694f48 to your computer and use it in GitHub Desktop.
Save MaksimDmitriev/21d5be2789434fb871ddec7f07694f48 to your computer and use it in GitHub Desktop.
JvmSuppressWildcards sample
object ListProcessor {
fun processStrings(strings: List<Any>) {
Printer.print(strings)
}
}
public class Printer {
public static void print(List <Object> list) {
for (Object o : list) {
System.out.println(o);
}
}
}
class SampleTest {
@Test
fun wildcard() {
val strings = listOf("Hello", "World")
ListProcessor.processStrings(strings)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment