compareTO in processing

edited October 2017 in Questions about Code

Hi, So I am trying to this basic insertion sort of an ArrayList.. Is there a way I can use java's 'compareTo' function in processing? I tried importing all sorts of java libs.. Still having the error 'the function compareTo in not defined'.. Thanks,

     void _sort(ArrayList<Word> A) {
        for (int i=0; i < A.size(); i++) {
          Word a = A.get(i);
          int pos = i;

          while ( (pos > 0) && (a.compareTo(A.get(pos-1)) >=1 )) {
            A.set(pos, A.get(pos-1));
          A.set(pos, a);


Sign In or Register to comment.