Created
December 18, 2017 09:24
-
-
Save igorokr/647edcea96e03ea805f8dee3703c36cd to your computer and use it in GitHub Desktop.
JavaMagick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Main { | |
public static class MyList<T> { | |
private List<Object> mInnerList = new ArrayList<>(); | |
public void addItem(T item) { | |
mInnerList.add(item); | |
} | |
public T getItem(int index) { | |
return (T) mInnerList.get(index); | |
} | |
public void injectItemReflationEmulation(Object o) { | |
mInnerList.add(o); | |
} | |
} | |
public static class Car { | |
} | |
public static class Person { | |
} | |
public static void main(String[] args) { | |
MyList<Car> myList = new MyList<>(); | |
myList.addItem(new Car()); | |
myList.addItem(new Car()); | |
myList.injectItemReflationEmulation(new Person()); | |
Car car = myList.getItem(2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment