package _4_wildcards;

import java.util.Arrays;
import java.util.List;

public class WildcardsExample
{
    public static void main(String[] args)
    {
        // set up
        List<Message> messages = Arrays.asList(
            new EmailMessage("Hello by email"),
            new TextMessage("Hello by text")
        );

        List<EmailMessage> emailMessages
            = Arrays.asList(new EmailMessage("Hello by email"));

        List<TextMessage> textMessages
            = Arrays.asList(new TextMessage("Hello by text"));

        // 0. log a message
        // 1. Lists aren't covariant
        // 2. Wildcards
    }

    static void log(Message message)
    {
        System.out.println(message);
    }

    static void logAll(List<Message> messages)
    {
        for (Message message : messages)
        {
            System.out.println(message);
        }
    }

}

@@ -101,26 +101,28 @@
 e%0A%7B%0A
+%0A
     p
-ublic
+rivate
  static 
 void
@@ -121,64 +121,13 @@
 tic 
-void main(String%5B%5D args)%0A    %7B%0A        // set up%0A       
+final
  Lis
@@ -167,28 +167,24 @@
 st(%0A        
-    
 new EmailMes
@@ -211,28 +211,24 @@
 %22),%0A        
-    
 new TextMess
@@ -256,20 +256,16 @@
     
-   
- 
 );%0A%0A    
     
@@ -256,27 +256,44 @@
     );%0A%0A    
-   
+private static final
  List%3CEmailM
@@ -306,36 +306,32 @@
 %3E emailMessages%0A
-    
         = Arrays
@@ -380,19 +380,36 @@
 );%0A%0A    
-   
+private static final
  List%3CTe
@@ -428,28 +428,24 @@
 extMessages%0A
-    
         = Ar
@@ -488,24 +488,73 @@
 y text%22));%0A%0A
+    public static void main(String%5B%5D args)%0A    %7B%0A
         // 0

move setup method out of main method