import java.io.BufferedReader; import java.io.StringReader; /** * Simple generic class example * @author gtowell * * @param */ @SuppressWarnings("unused") public class GenericClass { /** A non-generic value */ private double amount; /** A generic value */ private A otherValue; public A getOther() { return otherValue; } public boolean equals(GenericClass g) { return otherValue.equals(g.getOther()); } /** * Constructor. * @param other the generic value * @param amt a double value. */ public GenericClass(A other, double amt) { this.otherValue = other; this.amount = amt; } public static void main(String[] args) { GenericClass gString = new GenericClass("ASDF", 24.5); System.out.println(gString); GenericClass gDouble = new GenericClass(99.5, 44.5); System.out.println(gDouble); GenericClass gBR = new GenericClass( new BufferedReader(new StringReader("When in the course")), 99.8); System.out.println(gBR); Place p = new Place("a", "b", "c"); Place p2 = new Place("a", "s", "d"); GenericClass g = new GenericClass(p, 1); GenericClass g2 = new GenericClass(p2, 2); System.out.println("Equals" + g.equals(g2)); }}