package xxxx;
import xxxx;
import xxxx;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
public class MySortList<E> {
public void sortByMethod(List<E> list, final String method,
final boolean reverseFlag) {
Collections.sort(list, new Comparator<Object>() {
@SuppressWarnings("unchecked")
public int compare(Object arg1, Object arg2) {
int result = 0;
try {
Method m1 = ((E) arg1).getClass().getMethod(method, null);
Method m2 = ((E) arg2).getClass().getMethod(method