public List < AtomContact > getContactsWithinDistance ( double distance ) { if ( distance >= cutoff ) throw new IllegalArgumentException ( "Given distance " + String . format ( "%.2f" , distance ) + " is larger than contacts' distance cutoff " + String . format ( "%.2f" , cutoff ) ) ; List < AtomContact > list = new ArrayList < AtomContact > ( ) ; for ( AtomContact contact : this . contacts . values ( ) ) { if ( contact . getDistance ( ) < distance ) { list . add ( contact ) ; } } return list ; }
Returns the list of contacts from this set that are within the given distance .