http://stackoverflow.com/a/4409139
You need to move type parameter to the method level to indicate that you have a generic method rather than generic class:
e.g.
static <E> void swapInList(List<E> listToSort, int idxOne, int idxTwo)
{
E tmpEle = listToSort.get(idxOne);
listToSort.set(idxOne, listToSort.get(idxTwo));
listToSort.set(idxTwo, tmpEle);
}
No comments:
Post a Comment