public static boolean locationsCrossAntimeridian(List<? extends Location> locations){
  if (locations == null) {
    throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR,"Location","locationsCrossAntimeridian","missingList"));
  }
  int len=locations.size();
  if (len < 2) {
    return false;
  }
  double lon1=normalizeLongitude(locations.get(0).longitude);
  double sig1=Math.signum(lon1);
  for (int idx=1; idx < len; idx++) {
    double lon2=normalizeLongitude(locations.get(idx).longitude);
    double sig2=Math.signum(lon2);
    if (sig1 != sig2) {
      double delta=Math.abs(lon1 - lon2);
      if (delta > 180 && delta < 360) {
        return true;
      }
    }
    lon1=lon2;
    sig1=sig2;
  }
  return false;
}

public static boolean locationsCrossAntimeridian ( List < ? extends Location > locations ) { if ( locations == null ) { throw new IllegalArgumentException ( Logger . logMessage ( Logger . ERROR , "Location" , "locationsCrossAntimeridian" , "missingList" ) ) ; } int len = locations . size ( ) ; if ( len < 2 ) { return false ; } double lon1 = normalizeLongitude ( locations . get ( 0 ) . longitude ) ; double sig1 = Math . signum ( lon1 ) ; for ( int idx = 1 ; idx < len ; idx ++ ) { double lon2 = normalizeLongitude ( locations . get ( idx ) . longitude ) ; double sig2 = Math . signum ( lon2 ) ; if ( sig1 != sig2 ) { double delta = Math . abs ( lon1 - lon2 ) ; if ( delta > 180 && delta < 360 ) { return true ; } } lon1 = lon2 ; sig1 = sig2 ; } return false ; }
determines whether a list of locations crosses the antimeridian .
