import java.util.ArrayList;

public class Hack4<T> {

  private T genericType;
  private ArrayList<Object> objects = new ArrayList<Object>();

  public Hack4(T genericType){
    this.genericType = genericType;
    
    castInstanceVars();

    objects.add((Integer) genericType);
    objects.add((Double) genericType);
    objects.add((Boolean) genericType);
    objects.add(genericType.toString());
  }

  public void castInstanceVars() {
  }

  public T get() {
    return this.genericType;
  }

  public ArrayList<Object> getCastedList() {
    return this.objects;
  }

  public void set(T genericType) {
    this.genericType = genericType;
    objects.set(0, (Integer) genericType);
    objects.set(1, (Double) genericType);
    objects.set(2, (Boolean) genericType);
    objects.set(3, genericType.toString());
  }
  
  public static void main(String[] Args) {
    Hack4<Integer> testOne = new Hack4<Integer>(1);
    System.out.println("Value before change: " + testOne.get());
    System.out.println("Value before change: " + testOne.get());
    testOne.set(2);
    System.out.println("Value after Change: " + testOne.get());

    Hack4<String> testTwo = new Hack4<String>("I don't deserve extra credit");
    System.out.println("Value before change: " + testTwo.get());
    testTwo.set("I deserve extra credit");
    System.out.println("Value after Change: " + testTwo.get());
  }

}