Answers for "string to integer compare"

0

java convert string to int and compare

Collections.sort(data, new Comparator<TXCartData>() {
        @Override
        public int compare(TXCartData lhs, TXCartData rhs) {
            int n1=Integer.parseInt(lhs.rowId);
            int n2=Integer.parseInt(rhs.rowId);
            if (n1>=n2){
                return 1;
            }
            return -1;
        }
    });
Posted by: Guest on April-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language