Code example for Range

Methods: contains

0
this.latitude = latitude;
        this.longitude = longitude;
        this.value = String.format( "%s,%s", this.latitude, this.longitude );
 
        if ( !LATITUDE_RANGE.contains( this.latitude ) )
        { 
            throw new IllegalArgumentException( String.format( "Latitude [%s] is not within range %s", this.latitude, LATITUDE_RANGE ) );
        } 
 
        if ( !LONGITUDE_RANGE.contains( this.longitude ) )
        { 
            throw new IllegalArgumentException( String.format( "Longitude [%s] is not within range %s", this.longitude, LONGITUDE_RANGE ) );
        } 
    } 
 
    public double getLatitude() 
    { 
        return this.latitude;
    }