Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. public class ABoringTestClass
  2. {
  3.     public class Class1
  4.     {
  5.         private ContainerContainer container = new ContainerContainer();
  6.  
  7.         public void function1()
  8.         {
  9.             container.list.add(new DuckContainer());
  10.             Object duck = container.list.get(0).getItem();
  11.         }
  12.     }
  13.  
  14.     public class ContainerContainer
  15.     {
  16.         public List<IContainer> list = new List<IContainer>;
  17.     }
  18.  
  19.     public interface IContainer<T>
  20.     {
  21.         T getItem();
  22.     }
  23.  
  24.     public class DuckContainer implements IContainer<Duck>
  25.     {
  26.         private Duck duck = new Duck();
  27.  
  28.         public Duck getItem()
  29.         {
  30.             return duck;
  31.         }
  32.     }
  33.  
  34.     public class Duck
  35.     {
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement