private boolean peerExists(String id){
  if (id == null)   return false;
  for (  Peer peer : peerList) {
    if (id.equals(peer.getPeerId())) {
      return true;
    }
  }
  return false;
}

private boolean peerExists ( String id ) { if ( id == null ) return false ; for ( Peer peer : peerList ) { if ( id . equals ( peer . getPeerId ( ) ) ) { return true ; } } return false ; }
check whether a peer exists .
