Skip to content

Instantly share code, notes, and snippets.

@igorokr
Created December 18, 2017 09:24
Show Gist options
  • Save igorokr/647edcea96e03ea805f8dee3703c36cd to your computer and use it in GitHub Desktop.
Save igorokr/647edcea96e03ea805f8dee3703c36cd to your computer and use it in GitHub Desktop.
JavaMagick
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