All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.parse.LengthComparator Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.parse;

import java.util.Comparator;

public class LengthComparator implements Comparator{
   
   public LengthComparator() {
      super();
   }

   @Override
   public int compare(String left, String right) {
      int leftLength = left.length();
      int rightLength = right.length();
      
      if(leftLength < rightLength) {
         return 1;
      }
      if(leftLength == rightLength) {
         return 0;
      }
      return -1; 
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy