public class Triplet{ private E first; private E second; private E third; public Triplet(E n1, E n2, E n3){ first=n1; second=n2; third=n3; } public Triplet(Triplet copy){ first=copy.getFirst(); second=copy.getSecond(); third=copy.getThird(); } public E getFirst(){ return first; } public E getSecond(){ return second; } public E getThird(){ return third; } public void shiftLeft(){ E tmp=first; first=second; second=third; third=tmp; } public void shift(int n){ n%=3; System.out.println("N is: "+n); n-=3; for(int i=0;i>n;i--) shiftLeft(); } public String toString(){ return "First ele: '"+first+"', second ele: '"+second+"', third ele: '"+third+"'"; } }